* [PATCH] scsi: lpfc: Fix some error codes in debugfs
@ 2021-03-12 7:42 Dan Carpenter
2021-03-16 3:13 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-03-12 7:42 UTC (permalink / raw)
To: James Smart
Cc: Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
James Bottomley, Alex Iannicelli, linux-scsi, kernel-janitors
If copy_from_user() or kstrtoull() fail then the correct behavior is to
return a negative error code.
Fixes: f9bb2da11db8 ("[SCSI] lpfc 8.3.27: T10 additions for SLI4")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/scsi/lpfc/lpfc_debugfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index ec5328f7f1d4..c69c2dbfc470 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -2424,7 +2424,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
memset(dstbuf, 0, 33);
size = (nbytes < 32) ? nbytes : 32;
if (copy_from_user(dstbuf, buf, size))
- return 0;
+ return -EFAULT;
if (dent == phba->debug_InjErrLBA) {
if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
@@ -2433,7 +2433,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
}
if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
- return 0;
+ return -EINVAL;
if (dent == phba->debug_writeGuard)
phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
--
2.30.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] scsi: lpfc: Fix some error codes in debugfs
2021-03-12 7:42 [PATCH] scsi: lpfc: Fix some error codes in debugfs Dan Carpenter
@ 2021-03-16 3:13 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2021-03-16 3:13 UTC (permalink / raw)
To: James Smart, Dan Carpenter
Cc: Martin K . Petersen, Dick Kennedy, linux-scsi, Alex Iannicelli,
kernel-janitors, James E.J. Bottomley, James Bottomley
On Fri, 12 Mar 2021 10:42:11 +0300, Dan Carpenter wrote:
> If copy_from_user() or kstrtoull() fail then the correct behavior is to
> return a negative error code.
Applied to 5.12/scsi-fixes, thanks!
[1/1] scsi: lpfc: Fix some error codes in debugfs
https://git.kernel.org/mkp/scsi/c/19f1bc7edf0f
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-16 3:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-12 7:42 [PATCH] scsi: lpfc: Fix some error codes in debugfs Dan Carpenter
2021-03-16 3:13 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox