Re: [PATCH 1/2] NFC: delete null dereference

2015-10-19 Thread Samuel Ortiz
Hi Julia, On Sat, Oct 17, 2015 at 11:32:19AM +0200, Julia Lawall wrote: > The exit label performs device_unlock(>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

Re: [PATCH 1/2] NFC: delete null dereference

2015-10-19 Thread Dan Carpenter
The next goto after that is messed up as well: 1056 dev = nfc_get_device(idx); 1057 if (!dev) 1058 return -ENODEV; 1059 1060 device_lock(>dev); 1061 1062 local = nfc_llcp_find_local(dev); 1063 if (!local) { 1064

Re: [PATCH 1/2] NFC: delete null dereference

2015-10-19 Thread Dan Carpenter
The next goto after that is messed up as well: 1056 dev = nfc_get_device(idx); 1057 if (!dev) 1058 return -ENODEV; 1059 1060 device_lock(>dev); 1061 1062 local = nfc_llcp_find_local(dev); 1063 if (!local) { 1064

Re: [PATCH 1/2] NFC: delete null dereference

2015-10-19 Thread Samuel Ortiz
Hi Julia, On Sat, Oct 17, 2015 at 11:32:19AM +0200, Julia Lawall wrote: > The exit label performs device_unlock(>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

[PATCH 1/2] NFC: delete null dereference

2015-10-17 Thread Julia Lawall
The exit label performs device_unlock(>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 --- net/nfc/netlink.c

[PATCH 1/2] NFC: delete null dereference

2015-10-17 Thread Julia Lawall
The exit label performs device_unlock(>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