Commit 19f1bc7e authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin K. Petersen

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: f9bb2da1 ("[SCSI] lpfc 8.3.27: T10 additions for SLI4")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5999b9e5
...@@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, ...@@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
memset(dstbuf, 0, 33); memset(dstbuf, 0, 33);
size = (nbytes < 32) ? nbytes : 32; size = (nbytes < 32) ? nbytes : 32;
if (copy_from_user(dstbuf, buf, size)) if (copy_from_user(dstbuf, buf, size))
return 0; return -EFAULT;
if (dent == phba->debug_InjErrLBA) { if (dent == phba->debug_InjErrLBA) {
if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') && if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
...@@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, ...@@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
} }
if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp))) if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
return 0; return -EINVAL;
if (dent == phba->debug_writeGuard) if (dent == phba->debug_writeGuard)
phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp; phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment