mirror of https://gitee.com/openkylin/linux.git
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:
parent
349c390f43
commit
efcdf9f5c8
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue