summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Carnuccio <joe.carnuccio@qlogic.com>2014-09-25 05:16:41 -0400
committerChristoph Hellwig <hch@lst.de>2014-09-25 14:25:02 +0200
commitefcdf9f5c8dfb1fa2b052e58e4ccb85541aee2cd (patch)
tree252e50fe578c91992e697ca1891b52bad97b839d
parent349c390f43c63c2c919b81beb84b3a7592f2dd14 (diff)
downloadop-kernel-dev-efcdf9f5c8dfb1fa2b052e58e4ccb85541aee2cd.zip
op-kernel-dev-efcdf9f5c8dfb1fa2b052e58e4ccb85541aee2cd.tar.gz
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>
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 04b3701..4788ecd0 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -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;
}
OpenPOWER on IntegriCloud