]> git.karo-electronics.de Git - linux-beck.git/commitdiff
qla2xxx: Fix potential return count bug in qla2xxx_get_vpd_field().
authorJoe Carnuccio <joe.carnuccio@qlogic.com>
Thu, 25 Sep 2014 09:16:41 +0000 (05:16 -0400)
committerChristoph Hellwig <hch@lst.de>
Thu, 25 Sep 2014 12:25:02 +0000 (14:25 +0200)
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>
drivers/scsi/qla2xxx/qla_sup.c

index 04b370182742df9cd12cf077f73b556f1201dc08..4788ecd0c42af5376b49f0c0d1042ff098b5cf9e 100644 (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;
 }