net/sched: simplify tcf_pedit_act

[ Upstream commit 95b069382351826c0ae37938070aa82dbeaf288d ]

Remove the check for a negative number of keys as
this cannot ever happen

Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 6c02568fd1ae ("net/sched: act_pedit: Parse L3 Header for L4 offset")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Pedro Tammela 2023-01-31 16:05:12 -03:00 committed by Greg Kroah-Hartman
parent 300be9f1dc
commit b4e5d0c4cf

View File

@ -348,8 +348,12 @@ static int pedit_skb_hdr_offset(struct sk_buff *skb,
static int tcf_pedit_act(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res)
{
enum pedit_header_type htype = TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET;
struct tcf_pedit *p = to_pedit(a);
struct tcf_pedit_key_ex *tkey_ex;
struct tcf_pedit_parms *parms;
struct tc_pedit_key *tkey;
u32 max_offset;
int i;
@ -365,16 +369,12 @@ static int tcf_pedit_act(struct sk_buff *skb, const struct tc_action *a,
tcf_lastuse_update(&p->tcf_tm);
tcf_action_update_bstats(&p->common, skb);
if (parms->tcfp_nkeys > 0) {
struct tc_pedit_key *tkey = parms->tcfp_keys;
struct tcf_pedit_key_ex *tkey_ex = parms->tcfp_keys_ex;
enum pedit_header_type htype =
TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET;
tkey = parms->tcfp_keys;
tkey_ex = parms->tcfp_keys_ex;
for (i = parms->tcfp_nkeys; i > 0; i--, tkey++) {
u32 *ptr, hdata;
int offset = tkey->off;
u32 *ptr, hdata;
int hoffset;
u32 val;
int rc;
@ -443,9 +443,6 @@ static int tcf_pedit_act(struct sk_buff *skb, const struct tc_action *a,
}
goto done;
} else {
WARN(1, "pedit BUG: index %d\n", p->tcf_index);
}
bad:
spin_lock(&p->tcf_lock);