diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2018-02-07 07:49:58 -0800 |
---|---|---|
committer | Pravin B Shelar <pshelar@ovn.org> | 2018-02-12 22:39:19 -0800 |
commit | 65e64d207cd98c6989dcaeed9c29a8b212c2aeba (patch) | |
tree | 2473cb223943ec44a8fe44750623fd520b7856eb /datapath | |
parent | b88ec467c6059f5cf3f0f27507f0515271067388 (diff) | |
download | openvswitch-65e64d207cd98c6989dcaeed9c29a8b212c2aeba.tar.gz |
datapath: meter: Use 64-bit arithmetic instead of 32-bit
Upstream commit:
commit 5b7789e8fa8f353ad8f2c44de2385cb161b22d32
Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
Date: Tue Jan 30 22:55:33 2018 -0600
Add suffix LL to constant 1000 in order to give the compiler
complete information about the proper arithmetic to use. Notice
that this constant is used in a context that expects an expression
of type long long int (64 bits, signed).
The expression (band->burst_size + band->rate) * 1000 is currently
being evaluated using 32-bit arithmetic.
Addresses-Coverity-ID: 1461563 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Diffstat (limited to 'datapath')
-rw-r--r-- | datapath/meter.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/datapath/meter.c b/datapath/meter.c index d36870b0e..f9e8f124b 100644 --- a/datapath/meter.c +++ b/datapath/meter.c @@ -498,7 +498,7 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb, long long int max_bucket_size; band = &meter->bands[i]; - max_bucket_size = (band->burst_size + band->rate) * 1000; + max_bucket_size = (band->burst_size + band->rate) * 1000LL; band->bucket += delta_ms * band->rate; if (band->bucket > max_bucket_size) |