All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] scsi: silence an overflow warning
@ 2015-03-18  8:21 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-03-18  8:21 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, kernel-janitors

Static checkers complain that these sprintf() calls can overflow one
character.  It's clear that the original author just forget to account
for the NUL character.

It is unlikely that we will have a billion SCSI hosts.  Even if we do,
when you consider alignment, then the overflow is going to happen in
padding and thus the overflow is not harmful.  But it costs us nothing
to fix this and it silences a static checker warning.

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

diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 251598e..a5d7464 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -138,7 +138,7 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
 {
 	struct scsi_host_template *sht = shost->hostt;
 	struct proc_dir_entry *p;
-	char name[10];
+	char name[12];
 
 	if (!sht->proc_dir)
 		return;
@@ -158,7 +158,7 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
  */
 void scsi_proc_host_rm(struct Scsi_Host *shost)
 {
-	char name[10];
+	char name[12];
 
 	if (!shost->hostt->proc_dir)
 		return;

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

* [patch] scsi: silence an overflow warning
@ 2015-03-18  8:21 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-03-18  8:21 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, kernel-janitors

Static checkers complain that these sprintf() calls can overflow one
character.  It's clear that the original author just forget to account
for the NUL character.

It is unlikely that we will have a billion SCSI hosts.  Even if we do,
when you consider alignment, then the overflow is going to happen in
padding and thus the overflow is not harmful.  But it costs us nothing
to fix this and it silences a static checker warning.

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

diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 251598e..a5d7464 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -138,7 +138,7 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
 {
 	struct scsi_host_template *sht = shost->hostt;
 	struct proc_dir_entry *p;
-	char name[10];
+	char name[12];
 
 	if (!sht->proc_dir)
 		return;
@@ -158,7 +158,7 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
  */
 void scsi_proc_host_rm(struct Scsi_Host *shost)
 {
-	char name[10];
+	char name[12];
 
 	if (!shost->hostt->proc_dir)
 		return;

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

end of thread, other threads:[~2015-03-18  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18  8:21 [patch] scsi: silence an overflow warning Dan Carpenter
2015-03-18  8:21 ` Dan Carpenter

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.