public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] PCI: Remove NULL device handling from PCI DMA API
@ 2018-10-30  9:10 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2018-10-30  9:10 UTC (permalink / raw)
  To: hch; +Cc: netdev, Bjorn Helgaas

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

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

only message in thread, other threads:[~2018-10-30 18:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-30  9:10 [bug report] PCI: Remove NULL device handling from PCI DMA API Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox