scsi: aacraid: Use memdup_user() as a cleanup
Fix coccicheck warning which recommends to use memdup_user().
This patch fixes the following coccicheck warning:
drivers/scsi/aacraid/commctrl.c:516:15-22: WARNING opportunity for memdup_user
Link: https://lore.kernel.org/r/1587868964-75969-1-git-send-email-zou_wei@huawei.com
Fixes: 4645df1035 ("[PATCH] aacraid: swapped kmalloc args.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
			
			
This commit is contained in:
		
							parent
							
								
									29022b6130
								
							
						
					
					
						commit
						8d925b1f00
					
				| @ -513,15 +513,9 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||||||
| 		goto cleanup; | 		goto cleanup; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	user_srbcmd = kmalloc(fibsize, GFP_KERNEL); | 	user_srbcmd = memdup_user(user_srb, fibsize); | ||||||
| 	if (!user_srbcmd) { | 	if (IS_ERR(user_srbcmd)) { | ||||||
| 		dprintk((KERN_DEBUG"aacraid: Could not make a copy of the srb\n")); | 		rcode = PTR_ERR(user_srbcmd); | ||||||
| 		rcode = -ENOMEM; |  | ||||||
| 		goto cleanup; |  | ||||||
| 	} |  | ||||||
| 	if(copy_from_user(user_srbcmd, user_srb,fibsize)){ |  | ||||||
| 		dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n")); |  | ||||||
| 		rcode = -EFAULT; |  | ||||||
| 		goto cleanup; | 		goto cleanup; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user