Skip to contentSkip to conversation

nl802154: add support for security layer

PATCH In review Dan Carpenter 3 participants 5 messages Oct 1, 2015 – Oct 2, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello Alexander Aring,

The patch a26c5fd7622d: "nl802154: add support for security layer" from Sep 28, 2015, leads to the following static checker warning:

	net/ieee802154/nl802154.c:1535 nl802154_add_llsec_key()
	warn: if statement not indented

net/ieee802154/nl802154.c
1530 if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
1531 info->attrs[NL802154_ATTR_SEC_KEY],
1532 nl802154_key_policy))
1533 return -EINVAL;
1534
1535 if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] ||
1536 !attrs[NL802154_KEY_ATTR_BYTES])

Should this be a return -EINVAL?

1537
1538 if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0)
1539 return -ENOBUFS;
1540

regards,
dan carpenter

maintainer
#1 lore raw

Hello Dan Carpenter,

Quoted 17 lines · Dan Carpenter

Hello Alexander Aring,

The patch a26c5fd7622d: "nl802154: add support for security layer" from Sep 28, 2015, leads to the following static checker warning:

	net/ieee802154/nl802154.c:1535 nl802154_add_llsec_key()
	warn: if statement not indented

net/ieee802154/nl802154.c
1530 if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
1531 info->attrs[NL802154_ATTR_SEC_KEY],
1532 nl802154_key_policy))
1533 return -EINVAL;
1534
1535 if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] ||
1536 !attrs[NL802154_KEY_ATTR_BYTES])

Quoted 2 lines

Should this be a return -EINVAL?

Yes. Can you please provide a patch which based on bluetooth-next to linux-wpan mailinglist?

Thanks.

- Alex

#2 lore raw

PATCH 1/1 nl802154: Missing return in nl802154_add_llsec_key()

There was a missing return here so it meant that often ieee802154_llsec_parse_key_id() was not called.

Fixes a26c5fd7622d ('nl802154: add support for security layer')
net/ieee802154/nl802154.c +1 -0
index 1e9e865..16ef0d9 100644
@@ -1534,6 +1534,7 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)
 
 	if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] ||
 	    !attrs[NL802154_KEY_ATTR_BYTES])
+		return -EINVAL;
 
 	if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0)
 		return -ENOBUFS;
#4 lore raw

Re: [patch] nl802154: Missing return in nl802154_add_llsec_key()

In reply to Dan Carpenter

Hi Dan,

Quoted 5 lines

There was a missing return here so it meant that often ieee802154_llsec_parse_key_id() was not called.

Fixes a26c5fd7622d ('nl802154: add support for security layer')

patch has been applied to bluetooth-next tree.

Regards

Marcel