Thread (15 messages) 15 messages, 3 authors, 2019-05-02

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

From: David Ahern <hidden>
Date: 2019-05-02 13:40:30
Also in: lkml

On 5/2/19 7:14 AM, Michal Kubecek wrote:
quoted
quoted
@@ -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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help