• A
    scsi: megaraid: fix format-overflow warning · 875826a7
    Arnd Bergmann 提交于
    gcc-7 complains that the firmware version strings might overflow
    for some values:
    
    drivers/scsi/megaraid.c: In function 'megaraid_probe_one':
    drivers/scsi/megaraid.c:314:33: error: '%d' directive writing between 1 and 2 bytes into a region of size between 1 and 2 [-Werror=format-overflow=]
    drivers/scsi/megaraid.c:314:33: note: directive argument in the range [0, 15]
    drivers/scsi/megaraid.c:314:3: note: 'sprintf' output between 7 and 9 bytes into a destination of size 7
    drivers/scsi/megaraid.c:320:35: error: '%d' directive writing between 1 and 2 bytes into a region of size between 1 and 2 [-Werror=format-overflow=]
    drivers/scsi/megaraid.c:320:35: note: directive argument in the range [0, 15]
    drivers/scsi/megaraid.c:320:3: note: 'sprintf' output between 7 and 9 bytes into a destination of size 7
    
    This makes the code use a truncating snprintf() instead, which shuts
    up that warning.
    Signed-off-by: NArnd Bergmann <arnd@arndb.de>
    Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
    875826a7
megaraid.c 107.3 KB