Subject: Re: [PATCH net-next v4 2/5] net/sched: act_pedit: use extack in 'ex' parsing errors

From: Jakub Kicinski <[email-masked]>
Date: Thu, 20 Apr 2023 19:36:40 -0700

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