linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] scsi: lpfc: Adding ability to reset chip via pci bus reset
@ 2019-08-29 12:41 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-08-29 12:41 UTC (permalink / raw)
  To: jsmart2021; +Cc: linux-scsi

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-29 12:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 12:41 [bug report] scsi: lpfc: Adding ability to reset chip via pci bus reset Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).