All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] iommu/vt-d: Fix IOMMU lookup for SR-IOV Virtual Functions
@ 2016-11-14 11:09 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-11-14 11:09 UTC (permalink / raw)
  To: ashok.raj-ral2JQCrhuEAvxtiuMwx3w
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Hello Ashok Raj,

This is a semi-automatic email about new static checker warnings.

The patch 1c387188c60f: "iommu/vt-d: Fix IOMMU lookup for SR-IOV 
Virtual Functions" from Oct 21, 2016, leads to the following Smatch 
complaint:

drivers/iommu/intel-iommu.c:918 device_to_iommu()
	 error: we previously assumed 'pdev' could be null (see line 908)

drivers/iommu/intel-iommu.c
   907		for_each_active_iommu(iommu, drhd) {
   908			if (pdev && segment != drhd->segment)
                            ^^^^
Other code assumes pdev can be NULL.

   909				continue;
   910	
   911			for_each_active_dev_scope(drhd->devices,
   912						  drhd->devices_cnt, i, tmp) {
   913				if (tmp == dev) {
   914					/* For a VF use its original BDF# not that of the PF
   915					 * which we used for the IOMMU lookup. Strictly speaking
   916					 * we could do this for all PCI devices; we only need to
   917					 * get the BDF# from the scope table for ACPI matches. */
   918					if (pdev->is_virtfn)
                                            ^^^^^^^^^^^^^^^
Not checked.

   919						goto got_pdev;
   920	
   921                                  *bus = drhd->devices[i].bus;
   922                                  *devfn = drhd->devices[i].devfn;
   923                                  goto out;
   924                          }
   925  
   926                          if (!pdev || !dev_is_pci(tmp))
                                     ^^^^
Checked here as well.

   927                                  continue;
   928  
   929                          ptmp = to_pci_dev(tmp);
   930                          if (ptmp->subordinate &&
   931                              ptmp->subordinate->number <= pdev->bus->number &&
   932                              ptmp->subordinate->busn_res.end >= pdev->bus->number)
   933                                  goto got_pdev;
   934                  }
   935  
   936                  if (pdev && drhd->include_all) {
   937                  got_pdev:

regards,
dan carpenter

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

only message in thread, other threads:[~2016-11-14 11:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-14 11:09 [bug report] iommu/vt-d: Fix IOMMU lookup for SR-IOV Virtual Functions Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.