• Nicolas Iooss's avatar
    scsi: qla2xxx: silence -Wformat-security warning · e2e8f619
    Nicolas Iooss authored
    qla24xx_enable_msix() calls scnprintf() with a non-literal format
    string. This makes clang report -Wformat-security warnings when
    compiling this function:
    
        drivers/scsi/qla2xxx/qla_isr.c:3083:7: error: format string is not a
        string literal (potentially insecure) [-Werror,-Wformat-security]
                            msix_entries[i].name);
                            ^~~~~~~~~~~~~~~~~~~~
        drivers/scsi/qla2xxx/qla_isr.c:3083:7: note: treat the string as an
        argument to avoid this
                            msix_entries[i].name);
                            ^
                            "%s",
        drivers/scsi/qla2xxx/qla_isr.c:3119:7: error: format string is not a
        string literal (potentially insecure) [-Werror,-Wformat-security]
                            msix_entries[QLA_ATIO_VECTOR].name);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/scsi/qla2xxx/qla_isr.c:3119:7: note: treat the string as an
        argument to avoid this
                            msix_entries[QLA_ATIO_VECTOR].name);
                            ^
                            "%s",
    
    Even though msix_entries[...].name are initialized as literal strings
    with no % character and are never modified, introduce a "%s" format
    parameter in order to silence this -Wformat-security warning and make
    clang able to detect at compile time real bugs related to string
    formatting.
    
    [mkp: typo]
    Signed-off-by: default avatarNicolas Iooss <nicolas.iooss_linux@m4x.org>
    Reviewed-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
    Acked-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    e2e8f619
qla_isr.c 90 KB