public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jsmart2021@gmail.com
Cc: linux-scsi@vger.kernel.org
Subject: [bug report] scsi: lpfc: Adding ability to reset chip via pci bus reset
Date: Thu, 29 Aug 2019 15:41:00 +0300	[thread overview]
Message-ID: <20190829124100.GB20116@mwanda> (raw)

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

                 reply	other threads:[~2019-08-29 12:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190829124100.GB20116@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jsmart2021@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox