[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230420193640.028e69cd@kernel.org>
Date: Thu, 20 Apr 2023 19:36:40 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Pedro Tammela <pctammela@...atatu.com>
Cc: netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, simon.horman@...igine.com
Subject: Re: [PATCH net-next v4 2/5] net/sched: act_pedit: use extack in
'ex' parsing errors
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
Powered by blists - more mailing lists