archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <>
To: James Smart <>
Cc: Dick Kennedy <>,
	"James E.J. Bottomley" <>,
	"Martin K. Petersen" <>,,
Subject: [PATCH] scsi: lpfc: use correct scnprintf() limit
Date: Thu, 16 Sep 2021 16:23:31 +0300	[thread overview]
Message-ID: <20210916132331.GE25094@kili> (raw)

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 <>
 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,
 	return len;

             reply	other threads:[~2021-09-16 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 13:23 Dan Carpenter [this message]
2021-09-16 20:22 ` James Smart
2021-09-22  4:44 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210916132331.GE25094@kili \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] scsi: lpfc: use correct scnprintf() limit' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).