qla2xxx: Fix potential return count bug in qla2xxx_get_vpd_field().

Call scnprintf() instead of snprintf() since the latter may return
an incorrect count in cases where the write is truncated to fit.

scnprintf() returns the count of what was actually written;
snprintf() returns the count of what would have been written.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Joe Carnuccio 2014-09-25 05:16:41 -04:00 committed by Christoph Hellwig
parent 349c390f43
commit efcdf9f5c8
1 changed files with 1 additions and 1 deletions

View File

@ -3163,7 +3163,7 @@ qla2xxx_get_vpd_field(scsi_qla_host_t *vha, char *key, char *str, size_t size)
}
if (pos < end - len && *pos != 0x78)
return snprintf(str, size, "%.*s", len, pos + 3);
return scnprintf(str, size, "%.*s", len, pos + 3);
return 0;
}