Skip to content

Commit 19f1bc7

Browse files
Dan Carpentermartinkpetersen
authored andcommitted
scsi: lpfc: Fix some error codes in debugfs
If copy_from_user() or kstrtoull() fail then the correct behavior is to return a negative error code. Link: https://lore.kernel.org/r/YEsbU/UxYypVrC7/@mwanda Fixes: f9bb2da ("[SCSI] lpfc 8.3.27: T10 additions for SLI4") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 5999b9e commit 19f1bc7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/scsi/lpfc/lpfc_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
24212421
memset(dstbuf, 0, 33);
24222422
size = (nbytes < 32) ? nbytes : 32;
24232423
if (copy_from_user(dstbuf, buf, size))
2424-
return 0;
2424+
return -EFAULT;
24252425

24262426
if (dent == phba->debug_InjErrLBA) {
24272427
if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
@@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
24302430
}
24312431

24322432
if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
2433-
return 0;
2433+
return -EINVAL;
24342434

24352435
if (dent == phba->debug_writeGuard)
24362436
phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;

0 commit comments

Comments
 (0)