Incremental processing run() callbacks must always move the node to a
valid state (< EN_STATE_MAX).  That's always the case but the code was
not explicitly checking for that which caused coverity to come up with
false positive reports like:

    4. index_parm: Indexing array engine_node_state_name of size 4 with state.
  364        VLOG_DBG("node: %s, old_state %s, new_state %s, reason: %s.",
  365                 node->name, engine_node_state_name[node->state],
  366                 engine_node_state_name[state], reason);

To guide the code analysis, add an assertion that fails if that's not
the case.

Suggested-by: Ales Musil <[email protected]>
Signed-off-by: Dumitru Ceara <[email protected]>
---
 lib/inc-proc-eng.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/inc-proc-eng.c b/lib/inc-proc-eng.c
index dd06a88c1d..a4b6c8cde3 100644
--- a/lib/inc-proc-eng.c
+++ b/lib/inc-proc-eng.c
@@ -353,6 +353,8 @@ engine_set_node_state(struct engine_node *node,
                       enum engine_node_state state,
                       const char *reason_fmt, ...)
 {
+    ovs_assert(state < EN_STATE_MAX);
+
     if (node->state == state) {
         return;
     }
-- 
2.52.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to