Message ID | 20231201175015.214214-4-pctammela@mojatatu.com (mailing list archive) |
---|---|
State | Accepted |
Commit | e09ac779f736e75eab501b77f2a4f13d245f0a6d |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net/sched: act_api: contiguous action arrays | expand |
On Fri, Dec 01, 2023 at 02:50:14PM -0300, Pedro Tammela wrote: > - 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; Seems you thought it would have been an abuse to use tcf_act_for_each_action() here as well, which I can understand.
On Fri, Dec 01, 2023 at 10:05:12AM -0800, Marcelo Ricardo Leitner wrote: > On Fri, Dec 01, 2023 at 02:50:14PM -0300, Pedro Tammela wrote: > > - 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; > > Seems you thought it would have been an abuse to use > tcf_act_for_each_action() here as well, which I can understand. Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
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; }