scsi: lpfc: Adding ability to reset chip via pci bus reset
Hello James Smart,
The patch 5021267af132: "scsi: lpfc: Adding ability to reset chip via pci bus reset" from Dec 13, 2018, leads to the following static checker warning:
drivers/scsi/lpfc/lpfc_attr.c:1322 lpfc_reset_pci_bus() warn: passing bogus address: '&(phba->pcidev)->dev' val = 176
drivers/scsi/lpfc/lpfc_attr.c
1309 static int
1310 lpfc_reset_pci_bus(struct lpfc_hba *phba)
1311 {
1312 struct pci_dev *pdev = phba->pcidev;
^^^^^^^^^^^^^^^^^^^pdev and phba->pcidev are the same.
1313 struct Scsi_Host *shost = NULL;
1314 struct lpfc_hba *phba_other = NULL;
1315 struct pci_dev *ptr = NULL;
1316 int res;
1317
1318 if (phba->cfg_enable_hba_reset != 2)
1319 return -ENOTSUPP;
1320
1321 if (!pdev) {
^^^^^They are both NULL.
1322 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "8345 pdev NULL!\n");
This passes "&(phba->pcidev)->dev" which is "(void *)176" to __dev_printk() which dereferences it. Can it really be NULL?
1323 return -ENODEV; 1324 } 1325 1326 res = lpfc_check_pci_resettable(phba); 1327 if (res) 1328 return res;
regards,
dan carpenter