diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2018-01-30 22:55:33 -0600 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-31 10:26:30 -0500 |
commit | 5b7789e8fa8f353ad8f2c44de2385cb161b22d32 (patch) | |
tree | 20c6dc0701b6a6f0a49b031e5765f3af8782618b /net/openvswitch | |
parent | e4823fbd229bfbba368b40cdadb8f4eeb20604cc (diff) | |
download | linux-5b7789e8fa8f353ad8f2c44de2385cb161b22d32.tar.gz linux-5b7789e8fa8f353ad8f2c44de2385cb161b22d32.tar.bz2 linux-5b7789e8fa8f353ad8f2c44de2385cb161b22d32.zip |
openvswitch: meter: Use 64-bit arithmetic instead of 32-bit
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>
Diffstat (limited to 'net/openvswitch')
-rw-r--r-- | net/openvswitch/meter.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index 3fbfc78991ac..04b94281a30b 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -488,7 +488,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) |