Skip to content

Commit

Permalink
app/testpmd: remove redundant policy action condition
Browse files Browse the repository at this point in the history
[ 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: f29fa2c ("app/testpmd: support policy actions per color")

Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
Acked-by: Ajit Khaparde <[email protected]>
Acked-by: Chengwen Feng <[email protected]>
  • Loading branch information
shemminger authored and kevintraynor committed Nov 27, 2024
1 parent 78d1ebc commit 3c69c95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/test-pmd/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,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;
Expand Down

0 comments on commit 3c69c95

Please sign in to comment.