aboutsummaryrefslogtreecommitdiff
path: root/net/ovn/patches/0004-fix-use-of-possible-uninitialized-var.patch
blob: 258f8e607288f408d761c72f8ea109909f2efc5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Fix the following compilation errors

ic/ovn-ic.c: In function 'main':
ic/ovn-ic.c:689:5: warning: 'ls' may be used uninitialized in this function [-Wmaybe-uninitialized]
  689 |     nbrec_logical_switch_update_ports_addvalue(ls, lsp);
      |     ^
ic/ovn-ic.c:430:40: note: 'ls' was declared here
  430 |     const struct nbrec_logical_switch *ls;
      |                                        ^

--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -433,7 +433,7 @@ find_ts_in_nb(struct ic_context *ctx, ch
         nbrec_logical_switch_index_init_row(ctx->nbrec_ls_by_name);
     nbrec_logical_switch_index_set_name(key, ts_name);
 
-    const struct nbrec_logical_switch *ls;
+    const struct nbrec_logical_switch *ls = NULL;
     bool found = false;
     NBREC_LOGICAL_SWITCH_FOR_EACH_EQUAL (ls, key, ctx->nbrec_ls_by_name) {
         const char *ls_ts_name = smap_get(&ls->other_config, "interconn-ts");