Skip to contentSkip to conversation

scsi: silence an overflow warning

PATCH New Dan Carpenter 1 participant 1 message Mar 18, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: silence an overflow warning

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.

drivers/scsi/scsi_proc.c +2 -2
index 251598e..a5d7464 100644
@@ -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;