Coverity reported a possible null dereference of ctx->db
inside the event processing loop in ovsdb_relay_run().

In practice, ctx->db is guaranteed to be non-NULL for valid relay_ctx
structures. Adding ovs_assert(ctx->db) documents this invariant and
ensures debug builds catch any misuse.

No change in runtime behavior; this only improves code safety and
satisfies static analysis.

Signed-off-by: Eelco Chaudron <echau...@redhat.com>
---
 ovsdb/relay.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ovsdb/relay.c b/ovsdb/relay.c
index 71a5b8e1c..a5e1a5f3a 100644
--- a/ovsdb/relay.c
+++ b/ovsdb/relay.c
@@ -380,6 +380,7 @@ ovsdb_relay_run(void)
         struct relay_ctx *ctx = node->data;
         struct ovs_list events;
 
+        ovs_assert(ctx->db && ctx->cs);
         ovsdb_txn_forward_run(ctx->db, ctx->cs);
         ovsdb_cs_run(ctx->cs, &events);
 
-- 
2.50.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to