summaryrefslogtreecommitdiff
path: root/net/sched
diff options
context:
space:
mode:
authorPedro Tammela <pctammela@mojatatu.com>2023-12-01 14:50:14 -0300
committerPaolo Abeni <pabeni@redhat.com>2023-12-05 11:15:08 +0100
commite09ac779f736e75eab501b77f2a4f13d245f0a6d (patch)
tree58407275374a5aed9f43624aa784968115ffc24f /net/sched
parenta0e947c9ccffe47d45aca793d9e7fe4f4494e381 (diff)
net/sched: act_api: stop loop over ops array on NULL in tcf_action_init
The ops array is contiguous, so stop processing whenever a NULL is found Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/act_api.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 2e948e5992b6..d3cb9f5b25da 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1506,10 +1506,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
err:
tcf_action_destroy(actions, flags & TCA_ACT_FLAGS_BIND);
err_mod:
- for (i = 0; i < TCA_ACT_MAX_PRIO; i++) {
- if (ops[i])
- module_put(ops[i]->owner);
- }
+ for (i = 0; i < TCA_ACT_MAX_PRIO && ops[i]; i++)
+ module_put(ops[i]->owner);
return err;
}