diff mbox series

[ovs-dev,v2,1/8] netdev-linux: Fix possible int overflow in tc_add_matchall_policer().

Message ID 6432a0813cc432e76b9a6ec8f1ff835d88a30818.1716896375.git.echaudro@redhat.com
State Changes Requested
Headers show
Series Coverity fixes. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Eelco Chaudron May 28, 2024, 11:39 a.m. UTC
Fix unintentional integer overflow reported by Coverity by adding
the ULL suffix to the numerical literals used in the multiplications.

Fixes: ed2300cca0d3 ("netdev-linux: Refactor put police action netlink message")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 lib/netdev-linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mike Pattrick May 28, 2024, 1:04 p.m. UTC | #1
On Tue, May 28, 2024 at 7:46 AM Eelco Chaudron <echaudro@redhat.com> wrote:
>
> Fix unintentional integer overflow reported by Coverity by adding
> the ULL suffix to the numerical literals used in the multiplications.
>
> Fixes: ed2300cca0d3 ("netdev-linux: Refactor put police action netlink message")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>

Acked-by: Mike Pattrick <mkp@redhat.com>
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 25349c605..eb0c5c624 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2915,8 +2915,8 @@  tc_add_matchall_policer(struct netdev *netdev, uint64_t kbits_rate,
     basic_offset = nl_msg_start_nested(&request, TCA_OPTIONS);
     action_offset = nl_msg_start_nested(&request, TCA_MATCHALL_ACT);
     nl_msg_put_act_police(&request, 0, kbits_rate, kbits_burst,
-                          kpkts_rate * 1000, kpkts_burst * 1000, TC_ACT_UNSPEC,
-                          false);
+                          kpkts_rate * 1000ULL, kpkts_burst * 1000ULL,
+                          TC_ACT_UNSPEC, false);
     nl_msg_end_nested(&request, action_offset);
     nl_msg_end_nested(&request, basic_offset);