kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] scsi: qedi: silence sprintf() overflow warning
@ 2017-02-07 13:01 Dan Carpenter
  2017-02-07 13:27 ` walter harms
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-02-07 13:01 UTC (permalink / raw)
  To: QLogic-Storage-Upstream, Thomas Gleixner
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	kernel-janitors

The problem here is this:

	sprintf(host_buf, "qedi_ofld%d", qedi->shost->host_no);

host_buf is 16 character so we only have 6 characters left for
->host_no.  But ->host_no is set in scsi_host_alloc():

	index = ida_simple_get(&host_index_ida, 0, 0, GFP_KERNEL);

It could theoretically go up to 0x8000000 so we need space for 10
digits.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 5eda21d903e9..0dcf3b08230c 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1735,7 +1735,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
 	u32 dp_module = 0;
 	u8 dp_level = 0;
 	bool is_vf = false;
-	char host_buf[16];
+	char host_buf[20];
 	struct qed_link_params link_params;
 	struct qed_slowpath_params sp_params;
 	struct qed_probe_params qed_params;

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

end of thread, other threads:[~2017-07-07 12:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 13:01 [patch] scsi: qedi: silence sprintf() overflow warning Dan Carpenter
2017-02-07 13:27 ` walter harms
2017-07-07 12:09   ` Dan Carpenter

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