diff mbox series

[ovs-dev,v2,1/5] general: Fix Clang's static analyzer 'Dead initialization' warnings.

Message ID 169807093673.1031379.2520647757996269696.stgit@ebuild
State Accepted
Delegated to: Simon Horman
Headers show
Series Fix some of Clang's static analyzer warnings. | 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 Oct. 23, 2023, 2:22 p.m. UTC
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
 lib/meta-flow.c   |    4 ++--
 lib/ofp-actions.c |    8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 474344194..aa7cf1fcb 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -2751,8 +2751,8 @@  static char *
 mf_from_integer_string(const struct mf_field *mf, const char *s,
                        uint8_t *valuep, uint8_t *maskp)
 {
+    const char *err_str;
     char *tail;
-    const char *err_str = "";
     int err;
 
     err = parse_int_string(s, valuep, mf->n_bytes, &tail);
@@ -2785,8 +2785,8 @@  syntax_error:
 static char *
 mf_from_packet_type_string(const char *s, ovs_be32 *packet_type)
 {
+    const char *err_str;
     char *tail;
-    const char *err_str = "";
     int err;
 
     if (*s != '(') {
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index d7e5f542a..da7b1dd31 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -4230,10 +4230,12 @@  encode_DELETE_FIELD(const struct ofpact_delete_field *delete_field,
                     enum ofp_version ofp_version OVS_UNUSED,
                     struct ofpbuf *out)
 {
-    struct nx_action_delete_field *nadf = put_NXAST_DELETE_FIELD(out);
-    size_t size = out->size;
+    size_t size;
 
-    out->size = size - sizeof nadf->pad;
+    put_NXAST_DELETE_FIELD(out);
+    size = out->size;
+
+    out->size = size - MEMBER_SIZEOF(struct nx_action_delete_field, pad);
     nx_put_mff_header(out, delete_field->field, 0, false);
     out->size = size;
 }