scsi: advansys: fix uninitialized data access
authorArnd Bergmann <arnd@arndb.de>
Thu, 23 Mar 2017 15:02:18 +0000 (16:02 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 4 Apr 2017 23:39:39 +0000 (19:39 -0400)
commit44a5b977128c0ffff0654392b40f4c2ce72a619b
treec374b36ae5ff1b943992b56220b927e05e301d5d
parent831488669a334ea10f60361bb90f473ce7f655ff
scsi: advansys: fix uninitialized data access

gcc-7.0.1 now warns about a previously unnoticed access of uninitialized
struct members:

drivers/scsi/advansys.c: In function 'AscMsgOutSDTR':
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);
                          ^
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The code has existed in this exact form at least since v2.6.12, and the
warning seems correct. This uses named initializers to ensure we
initialize all members of the structure.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/advansys.c