]> git.feebdaed.xyz Git - 0xmirror/ovs.git/commitdiff
ovsdb: transaction: Silence dereference after null check warning.
authorEelco Chaudron <echaudro@redhat.com>
Mon, 1 Sep 2025 10:10:41 +0000 (12:10 +0200)
committerEelco Chaudron <echaudro@redhat.com>
Thu, 4 Sep 2025 06:45:17 +0000 (08:45 +0200)
Coverity reported a possible null dereference of datum->values
when handling value-type weak references in find_and_add_weak_refs().

In practice, datum->values must be non-NULL for value-type weak references.
Adding ovs_assert(datum->values) documents this invariant and ensures that
we catch any unexpected misuse.

No change to runtime behavior in production builds; this only improves
safety and satisfies static analysis.

Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
ovsdb/transaction.c

index 39650d3b31f1ab80f4eecebc412b1c7022b7d9c3..d16f4daa386dfddc0e2222f57cd021045363119a 100644 (file)
@@ -646,6 +646,7 @@ find_and_add_weak_refs(const struct ovsdb_row *src,
     }
 
     if (ovsdb_base_type_is_weak_ref(&column->type.value)) {
+        ovs_assert(!datum->n || datum->values);
         for (i = 0; i < datum->n; i++) {
             find_and_add_weak_ref(src, &datum->keys[i], &datum->values[i],
                                   column, false, ref_list, not_found, zero);