Re: [PATCH net-next 3/3] netlink: add validation of NLA_F_NESTED flag

From: David Ahern
Date: Thu May 02 2019 - 09:40:49 EST


On 5/2/19 7:14 AM, Michal Kubecek wrote:
>>> @@ -1132,6 +1136,10 @@ static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
>>> const struct nla_policy *policy,
>>> struct netlink_ext_ack *extack)
>>> {
>>> + if (!(nla->nla_type & NLA_F_NESTED)) {
>>> + NL_SET_ERR_MSG_ATTR(extack, nla, "nested attribute expected");
>>
>> Maybe reword that to say "NLA_F_NESTED is missing" or so? The "nested
>> attribute expected" could result in a lot of headscratching (without
>> looking at the code) because it looks nested if you do nla_nest_start()
>> etc.
>
> How about "NLA_F_NESTED is missing" and "NLA_F_NESTED not expected"?
>

That is much better to me.