public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: hch@lst.de
Cc: netdev@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>
Subject: [bug report] PCI: Remove NULL device handling from PCI DMA API
Date: Tue, 30 Oct 2018 12:10:43 +0300	[thread overview]
Message-ID: <20181030091043.seqnj5fahscgr46x@kili.mountain> (raw)

Hello Christoph Hellwig,

The patch 4167b2ad5182: "PCI: Remove NULL device handling from PCI
DMA API" from Jan 10, 2018, leads to the following static checker
warning:

	drivers/net/ethernet/amd/pcnet32.c:1921 pcnet32_probe1()
	warn: variable dereferenced before check 'pdev' (see line 1843)

drivers/net/ethernet/amd/pcnet32.c
  1839  
  1840          dev->base_addr = ioaddr;
  1841          lp = netdev_priv(dev);
  1842          /* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */
  1843          lp->init_block = pci_alloc_consistent(pdev, sizeof(*lp->init_block),
                                                      ^^^^
This function is called with a NULL "pdev" when we're probing from
pcnet32_probe_vlbus().

  1844                                                &lp->init_dma_addr);
  1845          if (!lp->init_block) {
  1846                  if (pcnet32_debug & NETIF_MSG_PROBE)
  1847                          pr_err("Consistent memory allocation failed\n");
  1848                  ret = -ENOMEM;
  1849                  goto err_free_netdev;
  1850          }
  1851          lp->pci_dev = pdev;
  1852  
  1853          lp->dev = dev;
  1854  

regards,
dan carpenter

                 reply	other threads:[~2018-10-30 18:03 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=20181030091043.seqnj5fahscgr46x@kili.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=bhelgaas@google.com \
    --cc=hch@lst.de \
    --cc=netdev@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