diff mbox series

[ovs-dev,V2,5/8] ovsdb: Fix 'table' may be used uninitialized

Message ID 20221116104727.915151-6-elibr@nvidia.com
State Deferred
Headers show
Series Fix warnings and enable Werror | 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

Eli Britstein Nov. 16, 2022, 10:47 a.m. UTC
With --enable-Werror and --with-dpdk=no:

../ovsdb/ovsdb.c: In function 'ovsdb_schema_from_json':
../ovsdb/ovsdb.c:246:9: error: 'table' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  246 |         shash_add(&schema->tables, table->name, table);
      |         ^
../ovsdb/ovsdb.c:230:36: note: 'table' was declared here
  230 |         struct ovsdb_table_schema *table;
      |                                    ^

Fixes: f85f8ebbfac9 ("Initial implementation of OVSDB.")
Signed-off-by: Eli Britstein <elibr@nvidia.com>
---
 ovsdb/ovsdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c
index 1c011fab0..8e0bbc967 100644
--- a/ovsdb/ovsdb.c
+++ b/ovsdb/ovsdb.c
@@ -227,7 +227,7 @@  ovsdb_schema_from_json(const struct json *json, struct ovsdb_schema **schemap)
     schema = ovsdb_schema_create(json_string(name), version,
                                  cksum ? json_string(cksum) : "");
     SHASH_FOR_EACH (node, json_object(tables)) {
-        struct ovsdb_table_schema *table;
+        struct ovsdb_table_schema *table = NULL;
 
         if (node->name[0] == '_') {
             error = ovsdb_syntax_error(json, NULL, "names beginning with "