Re: [PATCH 08/14] mpt3sas: Update hba_port objects after host reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sreekanth,

url:    https://github.com/0day-ci/linux/commits/Sreekanth-Reddy/mpt3sas-Add-support-for-multi-port-path-topology/20201010-011607
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: s390-randconfig-m031-20201009 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

New smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_scsih.c:5940 _scsih_look_and_get_matched_port_entry() error: uninitialized symbol 'matched_code'.

Old smatch warnings:
drivers/scsi/mpt3sas/mpt3sas_scsih.c:5949 _scsih_look_and_get_matched_port_entry() error: uninitialized symbol 'matched_code'.
drivers/scsi/mpt3sas/mpt3sas_scsih.c:5961 _scsih_look_and_get_matched_port_entry() error: uninitialized symbol 'matched_code'.
drivers/scsi/mpt3sas/mpt3sas_scsih.c:6472 _scsih_expander_add() warn: returning -1 instead of -ENOMEM is sloppy
drivers/scsi/mpt3sas/mpt3sas_scsih.c:10234 _mpt3sas_fw_work() warn: inconsistent indenting

vim +/matched_code +5940 drivers/scsi/mpt3sas/mpt3sas_scsih.c

2756bd46f6fdde Sreekanth Reddy 2020-10-09  5909  static enum hba_port_matched_codes
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5910  _scsih_look_and_get_matched_port_entry(struct MPT3SAS_ADAPTER *ioc,
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5911  	struct hba_port *port_entry,
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5912  	struct hba_port **matched_port_entry, int *count)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5913  {
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5914  	struct hba_port *port_table_entry, *matched_port = NULL;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5915  	enum hba_port_matched_codes matched_code;
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2756bd46f6fdde Sreekanth Reddy 2020-10-09  5916  	int lcount = 0;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5917  	*matched_port_entry = NULL;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5918  
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5919  	list_for_each_entry(port_table_entry, &ioc->port_table_list, list) {
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5920  		if (!(port_table_entry->flags & HBA_PORT_FLAG_DIRTY_PORT))
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5921  			continue;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5922  
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5923  		if ((port_table_entry->sas_address == port_entry->sas_address)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5924  		    && (port_table_entry->phy_mask == port_entry->phy_mask)) {
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5925  			matched_code = MATCHED_WITH_ADDR_AND_PHYMASK;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5926  			matched_port = port_table_entry;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5927  			break;

This is a break statement.

2756bd46f6fdde Sreekanth Reddy 2020-10-09  5928  		}
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5929  
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5930  		if ((port_table_entry->sas_address == port_entry->sas_address)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5931  		    && (port_table_entry->phy_mask & port_entry->phy_mask)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5932  		    && (port_table_entry->port_id == port_entry->port_id)) {

This is only true if "port_table_entry->port_id == port_entry->port_id"

2756bd46f6fdde Sreekanth Reddy 2020-10-09  5933  			matched_code = MATCHED_WITH_ADDR_SUBPHYMASK_AND_PORT;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5934  			matched_port = port_table_entry;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5935  			continue;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5936  		}
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5937  
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5938  		if ((port_table_entry->sas_address == port_entry->sas_address)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5939  		    && (port_table_entry->phy_mask & port_entry->phy_mask)) {
2756bd46f6fdde Sreekanth Reddy 2020-10-09 @5940  			if (matched_code ==
                                                                            ^^^^^^^^^^^^
Possibly uninitialized.  Smatch only complains about the first
intance otherwise it would probably complain about after the loop as
well.

2756bd46f6fdde Sreekanth Reddy 2020-10-09  5941  			    MATCHED_WITH_ADDR_SUBPHYMASK_AND_PORT)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5942  				continue;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5943  			matched_code = MATCHED_WITH_ADDR_AND_SUBPHYMASK;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5944  			matched_port = port_table_entry;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5945  			continue;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5946  		}
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5947  
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5948  		if (port_table_entry->sas_address == port_entry->sas_address) {
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5949  			if (matched_code ==
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5950  			    MATCHED_WITH_ADDR_SUBPHYMASK_AND_PORT)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5951  				continue;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5952  			if (matched_code == MATCHED_WITH_ADDR_AND_SUBPHYMASK)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5953  				continue;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5954  			matched_code = MATCHED_WITH_ADDR;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5955  			matched_port = port_table_entry;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5956  			lcount++;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5957  		}
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5958  	}
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5959  
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5960  	*matched_port_entry = matched_port;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5961  	if (matched_code ==  MATCHED_WITH_ADDR)
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5962  		*count = lcount;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5963  	return matched_code;
2756bd46f6fdde Sreekanth Reddy 2020-10-09  5964  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux