diff options
author | Pedro Tammela <pctammela@mojatatu.com> | 2023-12-01 20:50:15 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-12-05 13:15:08 +0300 |
commit | f9bfc8eb1342c7ddbe1b7be9d1ebd5bc80fb72b0 (patch) | |
tree | 541e27b7d2f3783bc878f86dc0054cea56c9ec8d /net/sched/act_api.c | |
parent | e09ac779f736e75eab501b77f2a4f13d245f0a6d (diff) | |
download | linux-f9bfc8eb1342c7ddbe1b7be9d1ebd5bc80fb72b0.tar.xz |
net/sched: act_api: use tcf_act_for_each_action in tcf_idr_insert_many
The actions array is contiguous, so stop processing whenever a NULL
is found. This is already the assumption for tcf_action_destroy[1],
which is called from tcf_actions_init.
[1] https://elixir.bootlin.com/linux/v6.7-rc3/source/net/sched/act_api.c#L1115
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/act_api.c')
-rw-r--r-- | net/sched/act_api.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index d3cb9f5b25da..abec5c45b5a4 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1285,14 +1285,12 @@ static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = { void tcf_idr_insert_many(struct tc_action *actions[]) { + struct tc_action *a; int i; - for (i = 0; i < TCA_ACT_MAX_PRIO; i++) { - struct tc_action *a = actions[i]; + tcf_act_for_each_action(i, a, actions) { struct tcf_idrinfo *idrinfo; - if (!a) - continue; idrinfo = a->idrinfo; mutex_lock(&idrinfo->lock); /* Replace ERR_PTR(-EBUSY) allocated by tcf_idr_check_alloc if |