All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: Terminate string in lpfc_debugfs_nvmeio_trc_write()
@ 2021-12-14  7:05 Dan Carpenter
  2021-12-14 15:10 ` James Smart
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-12-14  7:05 UTC (permalink / raw)
  To: James Smart, Dick Kennedy
  Cc: James E.J. Bottomley, Martin K. Petersen, Hannes Reinecke,
	linux-scsi, kernel-janitors

The "mybuf" string comes from the user, so we need to ensure that it is
NUL terminated.

Fixes: bd2cdd5e400f ("scsi: lpfc: NVME Initiator: Add debugfs support")
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 21152c9a96ef..30fac2f6fb06 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -2954,8 +2954,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
 	char mybuf[64];
 	char *pbuf;
 
-	if (nbytes > 64)
-		nbytes = 64;
+	if (nbytes > 63)
+		nbytes = 63;
 
 	memset(mybuf, 0, sizeof(mybuf));
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-07  9:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14  7:05 [PATCH] scsi: lpfc: Terminate string in lpfc_debugfs_nvmeio_trc_write() Dan Carpenter
2021-12-14 15:10 ` James Smart
2021-12-17  4:04 ` Martin K. Petersen
2021-12-23  5:08 ` Martin K. Petersen
2021-12-31 14:55 ` James Bottomley
2022-01-07  9:31   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.