Commit efcdf9f5 authored by Joe Carnuccio's avatar Joe Carnuccio Committed by Christoph Hellwig

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: default avatarJoe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 349c390f
...@@ -3163,7 +3163,7 @@ qla2xxx_get_vpd_field(scsi_qla_host_t *vha, char *key, char *str, size_t size) ...@@ -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) if (pos < end - len && *pos != 0x78)
return snprintf(str, size, "%.*s", len, pos + 3); return scnprintf(str, size, "%.*s", len, pos + 3);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment