From: Jakub Kicinski <kuba@kernel.org>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC] netlink: check for NULL attribute in nla_parse_nested_deprecated
Date: Mon, 19 Feb 2024 11:13:13 -0800 [thread overview]
Message-ID: <20240219111313.75bcb905@kernel.org> (raw)
In-Reply-To: <20240216015257.10020-1-stephen@networkplumber.org>
On Thu, 15 Feb 2024 17:52:48 -0800 Stephen Hemminger wrote:
> Lots of code in network schedulers has the pattern:
> if (!nla) {
> NL_SET_ERR_MSG_MOD(extack, "missing attributes");
> return -EINVAL;
> }
>
> err = nla_parse_nested_deprecated(tb, TCA_CSUM_MAX, nla, csum_policy,
> NULL);
> if (err < 0)
> return err;
>
> The check for nla being NULL can be moved into nla_parse_nested_deprecated().
> Which simplifies lots of places.
If it's mainly TC which has this problem the fix belongs in TC,
not in the generic code.
prev parent reply other threads:[~2024-02-19 19:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 1:52 [RFC] netlink: check for NULL attribute in nla_parse_nested_deprecated Stephen Hemminger
2024-02-19 12:56 ` Simon Horman
2024-02-19 19:13 ` Jakub Kicinski [this message]
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=20240219111313.75bcb905@kernel.org \
--to=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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).