mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 08:44:41 +00:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									b43ef78145
								
							
						
					
					
						commit
						9abebb8a10
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		|  | @ -1109,10 +1109,8 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info) | |||
| 	idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); | ||||
| 
 | ||||
| 	dev = nfc_get_device(idx); | ||||
| 	if (!dev) { | ||||
| 		rc = -ENODEV; | ||||
| 		goto exit; | ||||
| 	} | ||||
| 	if (!dev) | ||||
| 		return -ENODEV; | ||||
| 
 | ||||
| 	device_lock(&dev->dev); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Julia Lawall
						Julia Lawall