Subject: Re: [RFC] netlink: check for NULL attribute in nla_parse_nested_deprecated

From: Jakub Kicinski <[email-masked]>
Date: Mon, 19 Feb 2024 11:13:13 -0800

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.