[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240219111313.75bcb905@kernel.org>
Date: Mon, 19 Feb 2024 11:13:13 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [RFC] netlink: check for NULL attribute in
nla_parse_nested_deprecated
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.
Powered by blists - more mailing lists