[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231128160631.663351-4-pctammela@mojatatu.com>
Date: Tue, 28 Nov 2023 13:06:30 -0300
From: Pedro Tammela <pctammela@...atatu.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
jhs@...atatu.com,
xiyou.wangcong@...il.com,
jiri@...nulli.us,
vladbu@...dia.com,
mleitner@...hat.com,
Pedro Tammela <pctammela@...atatu.com>
Subject: [PATCH RFC net-next 3/4] 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
Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
---
net/sched/act_api.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index bf6f9ca15a30..8517bfbd69a6 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1510,10 +1510,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;
}
--
2.40.1
Powered by blists - more mailing lists