diff options
author | Alan Cox <alan@linux.intel.com> | 2009-06-09 08:44:02 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-09 11:31:46 -0400 |
commit | 238ddbb98c327a7392ced5ae65216c55969749ea (patch) | |
tree | db32edfaa5b71261c53a87bdc4d9b860e88f4091 | |
parent | cf4e6363859d30f24f8cd3e8930dbff399cc3550 (diff) |
[SCSI] gdth: fix overlapping snprintf users
Closes-bug: http://bugzilla.kernel.org/show_bug.cgi?id=13438
Closes-bug: http://bugzilla.kernel.org/show_bug.cgi?id=13437
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/gdth_proc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c index 59349a316e1..1258da34fbc 100644 --- a/drivers/scsi/gdth_proc.c +++ b/drivers/scsi/gdth_proc.c | |||
@@ -152,6 +152,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
152 | struct Scsi_Host *host, gdth_ha_str *ha) | 152 | struct Scsi_Host *host, gdth_ha_str *ha) |
153 | { | 153 | { |
154 | int size = 0,len = 0; | 154 | int size = 0,len = 0; |
155 | int hlen; | ||
155 | off_t begin = 0,pos = 0; | 156 | off_t begin = 0,pos = 0; |
156 | int id, i, j, k, sec, flag; | 157 | int id, i, j, k, sec, flag; |
157 | int no_mdrv = 0, drv_no, is_mirr; | 158 | int no_mdrv = 0, drv_no, is_mirr; |
@@ -192,11 +193,11 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
192 | if (reserve_list[0] == 0xff) | 193 | if (reserve_list[0] == 0xff) |
193 | strcpy(hrec, "--"); | 194 | strcpy(hrec, "--"); |
194 | else { | 195 | else { |
195 | sprintf(hrec, "%d", reserve_list[0]); | 196 | hlen = sprintf(hrec, "%d", reserve_list[0]); |
196 | for (i = 1; i < MAX_RES_ARGS; i++) { | 197 | for (i = 1; i < MAX_RES_ARGS; i++) { |
197 | if (reserve_list[i] == 0xff) | 198 | if (reserve_list[i] == 0xff) |
198 | break; | 199 | break; |
199 | sprintf(hrec,"%s,%d", hrec, reserve_list[i]); | 200 | hlen += snprintf(hrec + hlen , 161 - hlen, ",%d", reserve_list[i]); |
200 | } | 201 | } |
201 | } | 202 | } |
202 | size = sprintf(buffer+len, | 203 | size = sprintf(buffer+len, |