diff mbox series

[ovs-dev] general: Fix overflowed integer arguments.

Message ID 7de11b4e7bf72b4438ab0554a4c856edd4b743b2.1733327334.git.echaudro@redhat.com
State Accepted
Commit ccf083b55709d2d4389e0cb2eab88aa3eebebbd2
Headers show
Series [ovs-dev] general: Fix overflowed integer arguments. | expand

Checks

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

Commit Message

Eelco Chaudron Dec. 4, 2024, 3:48 p.m. UTC
Fix the "Overflowed integer argument" error reported by Coverity.

This is done by using the same variable type as the argument as the index/id.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 lib/nx-match.c  | 6 +++---
 lib/ofp-table.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Ilya Maximets Dec. 11, 2024, 12:54 p.m. UTC | #1
On 12/4/24 16:48, Eelco Chaudron wrote:
> Fix the "Overflowed integer argument" error reported by Coverity.
> 
> This is done by using the same variable type as the argument as the index/id.
> 
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
>  lib/nx-match.c  | 6 +++---
>  lib/ofp-table.c | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)

Acked-by: Ilya Maximets <i.maximets@ovn.org>
Eelco Chaudron Dec. 12, 2024, 1:47 p.m. UTC | #2
On 11 Dec 2024, at 13:54, Ilya Maximets wrote:

> On 12/4/24 16:48, Eelco Chaudron wrote:
>> Fix the "Overflowed integer argument" error reported by Coverity.
>>
>> This is done by using the same variable type as the argument as the index/id.
>>
>> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
>> ---
>>  lib/nx-match.c  | 6 +++---
>>  lib/ofp-table.c | 2 +-
>>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> Acked-by: Ilya Maximets <i.maximets@ovn.org>

Thanks for the review Ilya, patch was applied to main!
diff mbox series

Patch

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 440f5f763..8686e4430 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -2148,10 +2148,10 @@  oxm_bitmap_from_mf_bitmap(const struct mf_bitmap *fields,
                           enum ofp_version version)
 {
     uint64_t oxm_bitmap = 0;
-    int i;
+    enum mf_field_id id;
 
-    BITMAP_FOR_EACH_1 (i, MFF_N_IDS, fields->bm) {
-        uint64_t oxm = mf_oxm_header(i, version);
+    BITMAP_FOR_EACH_1 (id, MFF_N_IDS, fields->bm) {
+        uint64_t oxm = mf_oxm_header(id, version);
         uint32_t class = nxm_class(oxm);
         int field = nxm_field(oxm);
 
diff --git a/lib/ofp-table.c b/lib/ofp-table.c
index f9bd3b7f9..0435df45b 100644
--- a/lib/ofp-table.c
+++ b/lib/ofp-table.c
@@ -604,8 +604,8 @@  put_fields_property(struct ofpbuf *reply,
                     enum ofp13_table_feature_prop_type property,
                     enum ofp_version version)
 {
+    enum mf_field_id field;
     size_t start_ofs;
-    int field;
 
     start_ofs = ofpprop_start(reply, property);
     BITMAP_FOR_EACH_1 (field, MFF_N_IDS, fields->bm) {