* [PATCH] scsi: mpi3mr: use scnprintf() instead of snprintf()
@ 2021-10-13 8:30 Dan Carpenter
2021-10-17 2:20 ` Martin K. Petersen
2021-10-21 3:42 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-10-13 8:30 UTC (permalink / raw)
To: Sathya Prakash Veerichetty
Cc: Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
James E.J. Bottomley, Martin K. Petersen, mpi3mr-linuxdrv.pdl,
linux-scsi, kernel-janitors
I intended to move from snprintf() to scnprintf() in the previous
patch but I messed up and did not do that. The result of my bug is
that it this function could trigger a WARN() if the buffer is too
large.
Fixes: 76a4f7cc5973 ("scsi: mpi3mr: Clean up mpi3mr_print_ioc_info()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/scsi/mpi3mr/mpi3mr_fw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index e34417a2429a..aa5d877df6f8 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -3045,7 +3045,7 @@ mpi3mr_print_ioc_info(struct mpi3mr_ioc *mrioc)
for (i = 0; i < ARRAY_SIZE(mpi3mr_protocols); i++) {
if (mrioc->facts.protocol_flags &
mpi3mr_protocols[i].protocol) {
- bytes_written += snprintf(protocol + bytes_written,
+ bytes_written += scnprintf(protocol + bytes_written,
sizeof(protocol) - bytes_written, "%s%s",
bytes_written ? "," : "",
mpi3mr_protocols[i].name);
@@ -3056,7 +3056,7 @@ mpi3mr_print_ioc_info(struct mpi3mr_ioc *mrioc)
for (i = 0; i < ARRAY_SIZE(mpi3mr_capabilities); i++) {
if (mrioc->facts.protocol_flags &
mpi3mr_capabilities[i].capability) {
- bytes_written += snprintf(capabilities + bytes_written,
+ bytes_written += scnprintf(capabilities + bytes_written,
sizeof(capabilities) - bytes_written, "%s%s",
bytes_written ? "," : "",
mpi3mr_capabilities[i].name);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: mpi3mr: use scnprintf() instead of snprintf()
2021-10-13 8:30 [PATCH] scsi: mpi3mr: use scnprintf() instead of snprintf() Dan Carpenter
@ 2021-10-17 2:20 ` Martin K. Petersen
2021-10-21 3:42 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-10-17 2:20 UTC (permalink / raw)
To: Dan Carpenter
Cc: Sathya Prakash Veerichetty, Kashyap Desai, Sumit Saxena,
Sreekanth Reddy, James E.J. Bottomley, Martin K. Petersen,
mpi3mr-linuxdrv.pdl, linux-scsi, kernel-janitors
Dan,
> I intended to move from snprintf() to scnprintf() in the previous
> patch but I messed up and did not do that. The result of my bug is
> that it this function could trigger a WARN() if the buffer is too
> large.
Applied to 5.16/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: mpi3mr: use scnprintf() instead of snprintf()
2021-10-13 8:30 [PATCH] scsi: mpi3mr: use scnprintf() instead of snprintf() Dan Carpenter
2021-10-17 2:20 ` Martin K. Petersen
@ 2021-10-21 3:42 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-10-21 3:42 UTC (permalink / raw)
To: Sathya Prakash Veerichetty, Dan Carpenter
Cc: Martin K . Petersen, Sumit Saxena, Kashyap Desai,
Sreekanth Reddy, mpi3mr-linuxdrv.pdl, linux-scsi,
James E.J. Bottomley, kernel-janitors
On Wed, 13 Oct 2021 11:30:05 +0300, Dan Carpenter wrote:
> I intended to move from snprintf() to scnprintf() in the previous
> patch but I messed up and did not do that. The result of my bug is
> that it this function could trigger a WARN() if the buffer is too
> large.
>
>
Applied to 5.16/scsi-queue, thanks!
[1/1] scsi: mpi3mr: use scnprintf() instead of snprintf()
https://git.kernel.org/mkp/scsi/c/30e99f05f8b1
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-21 3:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 8:30 [PATCH] scsi: mpi3mr: use scnprintf() instead of snprintf() Dan Carpenter
2021-10-17 2:20 ` Martin K. Petersen
2021-10-21 3:42 ` Martin K. Petersen
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.