netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com,
	simon.horman@corigine.com
Subject: Re: [PATCH net-next v4 2/5] net/sched: act_pedit: use extack in 'ex' parsing errors
Date: Thu, 20 Apr 2023 19:36:40 -0700	[thread overview]
Message-ID: <20230420193640.028e69cd@kernel.org> (raw)
In-Reply-To: <20230418234354.582693-3-pctammela@mojatatu.com>

On Tue, 18 Apr 2023 20:43:51 -0300 Pedro Tammela wrote:
> -		if (nla_type(ka) != TCA_PEDIT_KEY_EX)
> +		if (nla_type(ka) != TCA_PEDIT_KEY_EX) {
> +			NL_SET_ERR_MSG_MOD(extack, "Unknown attribute, expected extended key");
>  			goto err_out;
> +		}

This is a check on ka, we should use NL_SET_ERR_MSG_ATTR()

>  		k->htype = nla_get_u16(tb[TCA_PEDIT_KEY_EX_HTYPE]);
>  		k->cmd = nla_get_u16(tb[TCA_PEDIT_KEY_EX_CMD]);
>  
>  		if (k->htype > TCA_PEDIT_HDR_TYPE_MAX ||
> -		    k->cmd > TCA_PEDIT_CMD_MAX)
> +		    k->cmd > TCA_PEDIT_CMD_MAX) {
> +			NL_SET_ERR_MSG_MOD(extack, "Extended key is malformed");

And these are checks for tb[TCA_PEDIT_KEY_EX_HTYPE] and
tb[TCA_PEDIT_KEY_EX_CMD], should be part of the parsing policy.
-- 
pw-bot: cr

  parent reply	other threads:[~2023-04-21  2:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 23:43 [PATCH net-next v4 0/5] net/sched: act_pedit: minor improvements Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 1/5] net/sched: act_pedit: simplify 'ex' key parsing error propagation Pedro Tammela
2023-04-19  9:37   ` Simon Horman
2023-04-21  2:33   ` Jakub Kicinski
2023-04-18 23:43 ` [PATCH net-next v4 2/5] net/sched: act_pedit: use extack in 'ex' parsing errors Pedro Tammela
2023-04-19  9:39   ` Simon Horman
2023-04-21  2:36   ` Jakub Kicinski [this message]
2023-04-18 23:43 ` [PATCH net-next v4 3/5] net/sched: act_pedit: check static offsets a priori Pedro Tammela
2023-04-21  2:41   ` Jakub Kicinski
2023-04-21 15:12     ` Pedro Tammela
2023-04-21 15:15       ` Jakub Kicinski
2023-04-21 16:10         ` Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 4/5] net/sched: act_pedit: remove extra check for key type Pedro Tammela
2023-04-18 23:43 ` [PATCH net-next v4 5/5] net/sched: act_pedit: rate limit datapath messages Pedro Tammela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230420193640.028e69cd@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --cc=simon.horman@corigine.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).