re: scsi: mpt3sas: Handle firmware faults during second half of IOC init

From: Colin Ian King
Date: Tue Jun 01 2021 - 07:41:40 EST


Hi,

Static analysis with Coverity on linux-next has detected an issue in
drivers/scsi/mpt3sas/mpt3sas_base.c with the following commit:

commit a0815c45c89f544861eae55d85ccee6b1b1451e8
Author: Suganath Prabu S <suganath-prabu.subramani@xxxxxxxxxxxx>
Date: Tue May 18 10:46:25 2021 +0530

scsi: mpt3sas: Handle firmware faults during second half of IOC init

The analysis is as follows:

7208 if (ioc->port_enable_cmds.status & MPT3_CMD_COMPLETE_ASYNC) {
7209 if (ioc_status == MPI2_IOCSTATUS_SUCCESS) {
7210 mpt3sas_port_enable_complete(ioc);
7211 return 1;
7212 } else {
7213 ioc->start_scan_failed = ioc_status;
7214 ioc->start_scan = 0;
7215 return 1;
7216 }

Structurally dead code (UNREACHABLE)
unreachable: This code cannot be reached:

7217 ioc->port_enable_cmds.status &=
~MPT3_CMD_COMPLETE_ASYNC;
7218 }

The return 1 statements in either parts of the proceeding if statement
end up with the ioc->port_enable_cmds.status masking assignment never
being reached.

Colin