[kbuild] [mkp-scsi:for-next 304/324] drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() warn: variable dereferenced before check 'pqi_sas_port->device' (see line 95)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next head: 857a80bbd7321161f986588160d97815d1b1206a commit: ec504b23df9d33260602affc50389cf070707c9b [304/324] scsi: smartpqi: Add phy ID support for the physical drives config: i386-randconfig-m021-20210406 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() warn: variable dereferenced before check 'pqi_sas_port->device' (see line 95) vim +97 drivers/scsi/smartpqi/smartpqi_sas_transport.c 6c223761eb5482 Kevin Barnett 2016-06-27 87 6c223761eb5482 Kevin Barnett 2016-06-27 88 static int pqi_sas_port_add_rphy(struct pqi_sas_port *pqi_sas_port, 6c223761eb5482 Kevin Barnett 2016-06-27 89struct sas_rphy *rphy) 6c223761eb5482 Kevin Barnett 2016-06-27 90 { 6c223761eb5482 Kevin Barnett 2016-06-27 91struct sas_identify *identify; 6c223761eb5482 Kevin Barnett 2016-06-27 92 6c223761eb5482 Kevin Barnett 2016-06-27 93identify = >identify; 6c223761eb5482 Kevin Barnett 2016-06-27 94identify->sas_address = pqi_sas_port->sas_address; ec504b23df9d33 Murthy Bhat 2021-03-11 @95identify->phy_identifier = pqi_sas_port->device->phy_id; Dereference 3d46a59a191e81 Don Brace 2018-12-07 96 3d46a59a191e81 Don Brace 2018-12-07 @97if (pqi_sas_port->device && Checked too late. 3d46a59a191e81 Don Brace 2018-12-07 98 pqi_sas_port->device->is_expander_smp_device) { 3d46a59a191e81 Don Brace 2018-12-07 99 identify->initiator_port_protocols = SAS_PROTOCOL_SMP; 3d46a59a191e81 Don Brace 2018-12-07 100 identify->target_port_protocols = SAS_PROTOCOL_SMP; 3d46a59a191e81 Don Brace 2018-12-07 101} else { 6c223761eb5482 Kevin Barnett 2016-06-27 102 identify->initiator_port_protocols = SAS_PROTOCOL_STP; 6c223761eb5482 Kevin Barnett 2016-06-27 103 identify->target_port_protocols = SAS_PROTOCOL_STP; 3d46a59a191e81 Don Brace 2018-12-07 104} 6c223761eb5482 Kevin Barnett 2016-06-27 105 6c223761eb5482 Kevin Barnett 2016-06-27 106return sas_rphy_add(rphy); 6c223761eb5482 Kevin Barnett 2016-06-27 107 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip ___ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
[kbuild] [mkp-scsi:for-next 304/324] drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() warn: variable dereferenced before check 'pqi_sas_port->device' (see line 95)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next head: 857a80bbd7321161f986588160d97815d1b1206a commit: ec504b23df9d33260602affc50389cf070707c9b [304/324] scsi: smartpqi: Add phy ID support for the physical drives config: i386-randconfig-m021-20210406 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() warn: variable dereferenced before check 'pqi_sas_port->device' (see line 95) vim +97 drivers/scsi/smartpqi/smartpqi_sas_transport.c 6c223761eb5482 Kevin Barnett 2016-06-27 88 static int pqi_sas_port_add_rphy(struct pqi_sas_port *pqi_sas_port, 6c223761eb5482 Kevin Barnett 2016-06-27 89struct sas_rphy *rphy) 6c223761eb5482 Kevin Barnett 2016-06-27 90 { 6c223761eb5482 Kevin Barnett 2016-06-27 91struct sas_identify *identify; 6c223761eb5482 Kevin Barnett 2016-06-27 92 6c223761eb5482 Kevin Barnett 2016-06-27 93identify = >identify; 6c223761eb5482 Kevin Barnett 2016-06-27 94identify->sas_address = pqi_sas_port->sas_address; ec504b23df9d33 Murthy Bhat 2021-03-11 @95identify->phy_identifier = pqi_sas_port->device->phy_id; New dereference 3d46a59a191e81 Don Brace 2018-12-07 96 3d46a59a191e81 Don Brace 2018-12-07 @97if (pqi_sas_port->device && Checked too late. 3d46a59a191e81 Don Brace 2018-12-07 98 pqi_sas_port->device->is_expander_smp_device) { 3d46a59a191e81 Don Brace 2018-12-07 99 identify->initiator_port_protocols = SAS_PROTOCOL_SMP; 3d46a59a191e81 Don Brace 2018-12-07 100 identify->target_port_protocols = SAS_PROTOCOL_SMP; 3d46a59a191e81 Don Brace 2018-12-07 101} else { 6c223761eb5482 Kevin Barnett 2016-06-27 102 identify->initiator_port_protocols = SAS_PROTOCOL_STP; 6c223761eb5482 Kevin Barnett 2016-06-27 103 identify->target_port_protocols = SAS_PROTOCOL_STP; 3d46a59a191e81 Don Brace 2018-12-07 104} 6c223761eb5482 Kevin Barnett 2016-06-27 105 6c223761eb5482 Kevin Barnett 2016-06-27 106return sas_rphy_add(rphy); 6c223761eb5482 Kevin Barnett 2016-06-27 107 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip ___ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org ___ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
[kbuild] [mkp-scsi:for-next 304/324] drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() warn: variable dereferenced before check 'pqi_sas_port->device' (see line 95)
CC: kbuild-...@lists.01.org TO: Murthy Bhat CC: "Martin K. Petersen" CC: Scott Benesh CC: Mike McGowen CC: Scott Teel CC: Kevin Barnett CC: Martin Wilck CC: Don Brace tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next head: 857a80bbd7321161f986588160d97815d1b1206a commit: ec504b23df9d33260602affc50389cf070707c9b [304/324] scsi: smartpqi: Add phy ID support for the physical drives :: branch date: 5 hours ago :: commit date: 7 hours ago config: i386-randconfig-m021-20210406 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() warn: variable dereferenced before check 'pqi_sas_port->device' (see line 95) vim +97 drivers/scsi/smartpqi/smartpqi_sas_transport.c 6c223761eb5482 Kevin Barnett 2016-06-27 87 6c223761eb5482 Kevin Barnett 2016-06-27 88 static int pqi_sas_port_add_rphy(struct pqi_sas_port *pqi_sas_port, 6c223761eb5482 Kevin Barnett 2016-06-27 89struct sas_rphy *rphy) 6c223761eb5482 Kevin Barnett 2016-06-27 90 { 6c223761eb5482 Kevin Barnett 2016-06-27 91struct sas_identify *identify; 6c223761eb5482 Kevin Barnett 2016-06-27 92 6c223761eb5482 Kevin Barnett 2016-06-27 93identify = >identify; 6c223761eb5482 Kevin Barnett 2016-06-27 94identify->sas_address = pqi_sas_port->sas_address; ec504b23df9d33 Murthy Bhat 2021-03-11 @95identify->phy_identifier = pqi_sas_port->device->phy_id; 3d46a59a191e81 Don Brace 2018-12-07 96 3d46a59a191e81 Don Brace 2018-12-07 @97if (pqi_sas_port->device && 3d46a59a191e81 Don Brace 2018-12-07 98 pqi_sas_port->device->is_expander_smp_device) { 3d46a59a191e81 Don Brace 2018-12-07 99 identify->initiator_port_protocols = SAS_PROTOCOL_SMP; 3d46a59a191e81 Don Brace 2018-12-07 100 identify->target_port_protocols = SAS_PROTOCOL_SMP; 3d46a59a191e81 Don Brace 2018-12-07 101} else { 6c223761eb5482 Kevin Barnett 2016-06-27 102 identify->initiator_port_protocols = SAS_PROTOCOL_STP; 6c223761eb5482 Kevin Barnett 2016-06-27 103 identify->target_port_protocols = SAS_PROTOCOL_STP; 3d46a59a191e81 Don Brace 2018-12-07 104} 6c223761eb5482 Kevin Barnett 2016-06-27 105 6c223761eb5482 Kevin Barnett 2016-06-27 106return sas_rphy_add(rphy); 6c223761eb5482 Kevin Barnett 2016-06-27 107 } 6c223761eb5482 Kevin Barnett 2016-06-27 108 :: The code at line 97 was first introduced by commit :: 3d46a59a191e81f7ada771b8db71553916b851da scsi: smartpqi: add smp_utils support :: TO: Don Brace :: CC: Martin K. Petersen --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip ___ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org