diff mbox series

[ovs-dev,v2,3/6] dpctl: Fix uninitialized value when deleting flows.

Message ID 20240523191152.589605-3-mkp@redhat.com
State Changes Requested
Headers show
Series [ovs-dev,v2,1/6] netdev-offload: Fix null pointer dereference' warnings on dump creation. | 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 fail test: fail

Commit Message

Mike Pattrick May 23, 2024, 7:11 p.m. UTC
Clang's static analyzer will complain about an uninitialized value
because we weren't setting a value for ufid_generated in all code paths.

Now we initialize this on declaration. This patch also corrects the
reverse x-mass of variable declaration.

Fixes: bbe2e3928747 ("dpctl: Fix broken flow deletion via ovs-dpctl due to missing ufid.")
Signed-off-by: Mike Pattrick <mkp@redhat.com>
---
 lib/dpctl.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpctl.c b/lib/dpctl.c
index 3c555a559..a70df5342 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -1359,19 +1359,17 @@  static int
 dpctl_del_flow_dpif(struct dpif *dpif, const char *key_s,
                     struct dpctl_params *dpctl_p)
 {
+    struct dpif_port_dump port_dump;
     struct dpif_flow_stats stats;
+    bool ufid_generated = false;
     struct dpif_port dpif_port;
-    struct dpif_port_dump port_dump;
-    struct ofpbuf key;
+    bool ufid_present = false;
+    struct simap port_names;
     struct ofpbuf mask; /* To be ignored. */
-
+    struct ofpbuf key;
     ovs_u128 ufid;
-    bool ufid_generated;
-    bool ufid_present;
-    struct simap port_names;
     int n, error;
 
-    ufid_present = false;
     n = odp_ufid_from_string(key_s, &ufid);
     if (n < 0) {
         dpctl_error(dpctl_p, -n, "parsing flow ufid");