Skip to content

Commit

Permalink
net: ieee802154: Return meaningful error codes from the netlink helpers
Browse files Browse the repository at this point in the history
Returning -1 does not indicate anything useful.

Use a standard and meaningful error code instead.

Fixes: a26c5fd ("nl802154: add support for security layer")
Signed-off-by: Miquel Raynal <[email protected]>
Acked-by: Alexander Aring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stefan Schmidt <[email protected]>
  • Loading branch information
miquelraynal authored and Stefan-Schmidt committed Jan 27, 2022
1 parent 621b24b commit 79c37ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/ieee802154/nl802154.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ static int nl802154_send_key(struct sk_buff *msg, u32 cmd, u32 portid,

hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
if (!hdr)
return -1;
return -ENOBUFS;

if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
goto nla_put_failure;
Expand Down Expand Up @@ -1634,7 +1634,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 cmd, u32 portid,

hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
if (!hdr)
return -1;
return -ENOBUFS;

if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
goto nla_put_failure;
Expand Down Expand Up @@ -1812,7 +1812,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 cmd, u32 portid,

hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
if (!hdr)
return -1;
return -ENOBUFS;

if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
goto nla_put_failure;
Expand Down Expand Up @@ -1988,7 +1988,7 @@ static int nl802154_send_seclevel(struct sk_buff *msg, u32 cmd, u32 portid,

hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
if (!hdr)
return -1;
return -ENOBUFS;

if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
goto nla_put_failure;
Expand Down

0 comments on commit 79c37ca

Please sign in to comment.