A fake command with a value of -1 is used and then stored in a
uint16_t, which generates a Coverity warning. This change will
store UINT16_MAX in such cases.

Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/ofp-meter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/ofp-meter.c b/lib/ofp-meter.c
index 9ea40a0bf..b0dbfecd4 100644
--- a/lib/ofp-meter.c
+++ b/lib/ofp-meter.c
@@ -581,7 +581,11 @@ parse_ofp_meter_mod_str__(struct ofputil_meter_mod *mm, 
char *string,
 
     switch (command) {
     case -1:
+        /* This is a special case for requesting meters, which has no
+         * specific command assigned. To avoid compiler warnings,
+         * set the command to UINT16_MAX. */
         fields = F_METER;
+        command = UINT16_MAX;
         break;
 
     case OFPMC13_ADD:
-- 
2.46.0

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

Reply via email to