diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2015-10-17 05:32:19 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-10-19 14:10:37 -0400 |
commit | 9abebb8a10ce93db45327bd3a4d06801e6db92f2 (patch) | |
tree | a968400c5287a50c57b4126bd05676b33e3e095e /net/nfc | |
parent | b43ef78145b10a3fb81a59596d562f21d9bab8d2 (diff) |
NFC: delete null dereference
The exit label performs device_unlock(&dev->dev);, which will fail when dev
is NULL, and nfc_put_device(dev);, which is not useful when dev is NULL, so
just exit the function immediately.
Problem found using scripts/coccinelle/null/deref_null.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/netlink.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index 853172c27f68..f04053295ff1 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -1109,10 +1109,8 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info) | |||
1109 | idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); | 1109 | idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); |
1110 | 1110 | ||
1111 | dev = nfc_get_device(idx); | 1111 | dev = nfc_get_device(idx); |
1112 | if (!dev) { | 1112 | if (!dev) |
1113 | rc = -ENODEV; | 1113 | return -ENODEV; |
1114 | goto exit; | ||
1115 | } | ||
1116 | 1114 | ||
1117 | device_lock(&dev->dev); | 1115 | device_lock(&dev->dev); |
1118 | 1116 | ||