kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: use correct scnprintf() limit
@ 2021-09-16 13:23 Dan Carpenter
  2021-09-16 20:22 ` James Smart
  2021-09-22  4:44 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-09-16 13:23 UTC (permalink / raw)
  To: James Smart
  Cc: Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
	linux-scsi, kernel-janitors

The limit should be "PAGE_SIZE - len" instead of "PAGE_SIZE".
We're not going to hit the limit so this fix will not affect runtime.

Fixes: 5b9e70b22cc5 ("scsi: lpfc: raise sg count for nvme to use available sg resources")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/lpfc/lpfc_attr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index b35bf70a8c0d..1e5a30eb04de 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -6204,7 +6204,8 @@ lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr,
 	len = scnprintf(buf, PAGE_SIZE, "SGL sz: %d  total SGEs: %d\n",
 		       phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt);
 
-	len += scnprintf(buf + len, PAGE_SIZE, "Cfg: %d  SCSI: %d  NVME: %d\n",
+	len += scnprintf(buf + len, PAGE_SIZE - len,
+			"Cfg: %d  SCSI: %d  NVME: %d\n",
 			phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt,
 			phba->cfg_nvme_seg_cnt);
 	return len;
-- 
2.20.1


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

* Re: [PATCH] scsi: lpfc: use correct scnprintf() limit
  2021-09-16 13:23 [PATCH] scsi: lpfc: use correct scnprintf() limit Dan Carpenter
@ 2021-09-16 20:22 ` James Smart
  2021-09-22  4:44 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: James Smart @ 2021-09-16 20:22 UTC (permalink / raw)
  To: Dan Carpenter, James Smart
  Cc: Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
	linux-scsi, kernel-janitors

On 9/16/2021 6:23 AM, Dan Carpenter wrote:
> The limit should be "PAGE_SIZE - len" instead of "PAGE_SIZE".
> We're not going to hit the limit so this fix will not affect runtime.
> 
> Fixes: 5b9e70b22cc5 ("scsi: lpfc: raise sg count for nvme to use available sg resources")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/scsi/lpfc/lpfc_attr.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 

looks good. Thank you

Reviewed-by: James Smart <jsmart2021@gmail.com>

-- james



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

* Re: [PATCH] scsi: lpfc: use correct scnprintf() limit
  2021-09-16 13:23 [PATCH] scsi: lpfc: use correct scnprintf() limit Dan Carpenter
  2021-09-16 20:22 ` James Smart
@ 2021-09-22  4:44 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-09-22  4:44 UTC (permalink / raw)
  To: James Smart, Dan Carpenter
  Cc: Martin K . Petersen, James E.J. Bottomley, linux-scsi,
	kernel-janitors, Dick Kennedy

On Thu, 16 Sep 2021 16:23:31 +0300, Dan Carpenter wrote:

> The limit should be "PAGE_SIZE - len" instead of "PAGE_SIZE".
> We're not going to hit the limit so this fix will not affect runtime.
> 
> 

Applied to 5.15/scsi-fixes, thanks!

[1/1] scsi: lpfc: use correct scnprintf() limit
      https://git.kernel.org/mkp/scsi/c/6dacc371b77f

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-09-22  4:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 13:23 [PATCH] scsi: lpfc: use correct scnprintf() limit Dan Carpenter
2021-09-16 20:22 ` James Smart
2021-09-22  4:44 ` 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;
as well as URLs for NNTP newsgroup(s).