linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manish Rangankar <mrangankar@marvell.com>
To: <martin.petersen@oracle.com>, <lduncan@suse.com>, <cleech@redhat.com>
Cc: <linux-scsi@vger.kernel.org>, <GR-QLogic-Storage-Upstream@marvell.com>
Subject: [PATCH 5/8] qedi: Use snprintf instead of sprintf
Date: Mon, 7 Sep 2020 22:24:09 -0700	[thread overview]
Message-ID: <20200908052412.21917-6-mrangankar@marvell.com> (raw)
In-Reply-To: <20200908052412.21917-1-mrangankar@marvell.com>

Use snprintf to limit max number of bytes to the buffer.

Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
---
 drivers/scsi/qedi/qedi_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index e1ec22d7d699..2db99613b8a9 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -2538,7 +2538,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
 	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC, "MAC address is %pM.\n",
 		  qedi->mac);
 
-	sprintf(host_buf, "host_%d", qedi->shost->host_no);
+	snprintf(host_buf, sizeof(host_buf), "host_%d", qedi->shost->host_no);
 	qedi_ops->common->set_name(qedi->cdev, host_buf);
 
 	qedi_ops->register_ops(qedi->cdev, &qedi_cb_ops, qedi);
-- 
2.25.0


  parent reply	other threads:[~2020-09-08  5:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08  5:24 [PATCH 0/8] qedi: Misc bug fixes and enhancements Manish Rangankar
2020-09-08  5:24 ` [PATCH 1/8] qedi: Use qed count from set_fp_int in msix allocation Manish Rangankar
2020-09-08  5:24 ` [PATCH 2/8] qedi: Skip f/w connection termination for pci shutdown handler Manish Rangankar
2020-09-08  5:24 ` [PATCH 3/8] qedi: Fix list_del corruption while removing active IO Manish Rangankar
2020-09-08  5:24 ` [PATCH 4/8] qedi: Protect active command list to avoid list corruption Manish Rangankar
2020-09-08  5:24 ` Manish Rangankar [this message]
2020-09-08  5:24 ` [PATCH 6/8] qedi: Mark all connections for recovery on link down event Manish Rangankar
2020-09-08  5:24 ` [PATCH 7/8] qedi: Add firmware error recovery invocation support Manish Rangankar
2020-09-08  5:24 ` [PATCH 8/8] qedi: Add support for handling the pcie errors Manish Rangankar

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20200908052412.21917-6-mrangankar@marvell.com \
    --to=mrangankar@marvell.com \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=cleech@redhat.com \
    --cc=lduncan@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).