From 1fb0641a6dbe0f1210756dd4ba5d538c27d24132 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 21 Nov 2024 10:23:29 -0800 Subject: [PATCH] app/testpmd: remove redundant policy action condition [ upstream commit 4c2e7468426ae6be3f2a8f2d15e7d1222083eb9d ] The loop over policy actions will always exit when it sees the flow end action, so the next check is redundant. Link: https://pvs-studio.com/en/blog/posts/cpp/1179/ Fixes: f29fa2c59b85 ("app/testpmd: support policy actions per color") Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson Acked-by: Ajit Khaparde Acked-by: Chengwen Feng --- app/test-pmd/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ff2e9da324..9c3d668e56 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2219,7 +2219,7 @@ port_meter_policy_add(portid_t port_id, uint32_t policy_id, for (act_n = 0, start = act; act->type != RTE_FLOW_ACTION_TYPE_END; act++) act_n++; - if (act_n && act->type == RTE_FLOW_ACTION_TYPE_END) + if (act_n > 0) policy.actions[i] = start; else policy.actions[i] = NULL;