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 <[email protected]>
---
 lib/nx-match.c  | 6 +++---
 lib/ofp-table.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

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) {
-- 
2.46.0

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

Reply via email to