diff options
author | Thomas Graf <tgraf@noironetworks.com> | 2014-08-29 12:20:21 +0200 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2014-08-29 10:49:46 -0700 |
commit | 7f03ee0889a2072a56be647179508c3d7df89652 (patch) | |
tree | 2153c011f65d6f2c6112c6da130f6704f26f6073 | |
parent | def2ae7777b84e17c5b31aa6b4679015761d5d1d (diff) | |
download | openvswitch-7f03ee0889a2072a56be647179508c3d7df89652.tar.gz |
netdev-linux: Cast policer rate to uint64_t to avoid overflow
tc_fill_rate() takes a 64bit int, casting kbits_rate from int
to uint64_t avoids a possible overflow when translating from
kbits to bytes.
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r-- | lib/netdev-linux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 14e217a1b..5b5b937bd 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -3693,7 +3693,7 @@ tc_add_policer(struct netdev *netdev, int kbits_rate, int kbits_burst) memset(&tc_police, 0, sizeof tc_police); tc_police.action = TC_POLICE_SHOT; tc_police.mtu = mtu; - tc_fill_rate(&tc_police.rate, (kbits_rate * 1000)/8, mtu); + tc_fill_rate(&tc_police.rate, ((uint64_t) kbits_rate * 1000)/8, mtu); tc_police.burst = tc_bytes_to_ticks(tc_police.rate.rate, kbits_burst * 1024); |