• Arnd Bergmann's avatar
    scsi: fusion: fix string overflow warning · b192b42a
    Arnd Bergmann authored
    gcc points out a theorerical string overflow:
    
    drivers/message/fusion/mptbase.c: In function 'mpt_detach':
    drivers/message/fusion/mptbase.c:2103:17: error: '%s' directive writing up to 31 bytes into a region of size 28 [-Werror=format-overflow=]
    sprintf(pname, MPT_PROCFS_MPTBASEDIR "/%s/summary", ioc->name);
                   ^~~~~
    drivers/message/fusion/mptbase.c:2103:2: note: 'sprintf' output between 13 and 44 bytes into a destination of size 32
    
    We can simply double the size of the local buffer here to be on the
    safe side, and using snprintf() instead of sprintf() protects us
    if ioc->name was not terminated properly.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    b192b42a
mptbase.c 237 KB