From: "Gustavo A. R. Silva" <[email protected]>

Upstream commit:
    commit 5b7789e8fa8f353ad8f2c44de2385cb161b22d32
    Author: Gustavo A. R. Silva <[email protected]>
    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 <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>

Signed-off-by: Greg Rose <[email protected]>
---
 datapath/meter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/datapath/meter.c b/datapath/meter.c
index d36870b..f9e8f12 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)
-- 
1.8.3.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to