Coverity reported a possible null dereference of t->reply
when handling errors in the "committing" state for "transact" requests.

In practice, t->reply is always non-NULL at this point, but static analysis
cannot infer this guarantee. Adding ovs_assert(t->reply) documents the
invariant for developers and ensures debug builds will 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/trigger.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c
index 62959416b..7644b67dd 100644
--- a/ovsdb/trigger.c
+++ b/ovsdb/trigger.c
@@ -398,6 +398,7 @@ ovsdb_trigger_try(struct ovsdb_trigger *t, long long int 
now)
                 /* Permanent error.  Transition to "completed" state to report
                  * it. */
                 if (!strcmp(t->request->method, "transact")) {
+                    ovs_assert(t->reply);
                     json_array_add(t->reply->result,
                                    ovsdb_error_to_json_free(error));
                     ovsdb_trigger_complete(t);
-- 
2.50.1

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

Reply via email to