lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 8 Dec 2019 08:48:29 +0800
From:   kbuild test robot <lkp@...el.com>
To:     James Sewart <jamessewart@...sta.com>
Cc:     kbuild-all@...ts.01.org, linux-pci@...r.kernel.org,
        Logan Gunthorpe <logang@...tatee.com>,
        Christoph Hellwig <hch@...radead.org>,
        Dmitry Safonov <0x7f454c46@...il.com>,
        iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
        Dmitry Safonov <dima@...sta.com>,
        Alex Williamson <alex.williamson@...hat.com>,
        Bjorn Helgaas <helgaas@...nel.org>
Subject: Re: [PATCH v6 2/3] PCI: Add parameter nr_devfns to pci_add_dma_alias

Hi James,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.4-rc8]
[also build test WARNING on next-20191206]
[cannot apply to pci/next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/James-Sewart/PCI-Fix-off-by-one-in-dma_alias_mask-allocation-size/20191204-034421
base:    af42d3466bdc8f39806b26f593604fdc54140bcb
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-91-g817270f-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@...el.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/iommu/amd_iommu.c:288:34: sparse: sparse: not enough arguments for function pci_add_dma_alias

vim +288 drivers/iommu/amd_iommu.c

e3156048346c28 Joerg Roedel   2016-04-08  234  
e3156048346c28 Joerg Roedel   2016-04-08  235  static u16 get_alias(struct device *dev)
e3156048346c28 Joerg Roedel   2016-04-08  236  {
e3156048346c28 Joerg Roedel   2016-04-08  237  	struct pci_dev *pdev = to_pci_dev(dev);
e3156048346c28 Joerg Roedel   2016-04-08  238  	u16 devid, ivrs_alias, pci_alias;
e3156048346c28 Joerg Roedel   2016-04-08  239  
6c0b43df74f900 Joerg Roedel   2016-05-09  240  	/* The callers make sure that get_device_id() does not fail here */
e3156048346c28 Joerg Roedel   2016-04-08  241  	devid = get_device_id(dev);
5ebb1bc2d63d90 Arindam Nath   2018-09-18  242  
5ebb1bc2d63d90 Arindam Nath   2018-09-18  243  	/* For ACPI HID devices, we simply return the devid as such */
5ebb1bc2d63d90 Arindam Nath   2018-09-18  244  	if (!dev_is_pci(dev))
5ebb1bc2d63d90 Arindam Nath   2018-09-18  245  		return devid;
5ebb1bc2d63d90 Arindam Nath   2018-09-18  246  
e3156048346c28 Joerg Roedel   2016-04-08  247  	ivrs_alias = amd_iommu_alias_table[devid];
5ebb1bc2d63d90 Arindam Nath   2018-09-18  248  
e3156048346c28 Joerg Roedel   2016-04-08  249  	pci_for_each_dma_alias(pdev, __last_alias, &pci_alias);
e3156048346c28 Joerg Roedel   2016-04-08  250  
e3156048346c28 Joerg Roedel   2016-04-08  251  	if (ivrs_alias == pci_alias)
e3156048346c28 Joerg Roedel   2016-04-08  252  		return ivrs_alias;
e3156048346c28 Joerg Roedel   2016-04-08  253  
e3156048346c28 Joerg Roedel   2016-04-08  254  	/*
e3156048346c28 Joerg Roedel   2016-04-08  255  	 * DMA alias showdown
e3156048346c28 Joerg Roedel   2016-04-08  256  	 *
e3156048346c28 Joerg Roedel   2016-04-08  257  	 * The IVRS is fairly reliable in telling us about aliases, but it
e3156048346c28 Joerg Roedel   2016-04-08  258  	 * can't know about every screwy device.  If we don't have an IVRS
e3156048346c28 Joerg Roedel   2016-04-08  259  	 * reported alias, use the PCI reported alias.  In that case we may
e3156048346c28 Joerg Roedel   2016-04-08  260  	 * still need to initialize the rlookup and dev_table entries if the
e3156048346c28 Joerg Roedel   2016-04-08  261  	 * alias is to a non-existent device.
e3156048346c28 Joerg Roedel   2016-04-08  262  	 */
e3156048346c28 Joerg Roedel   2016-04-08  263  	if (ivrs_alias == devid) {
e3156048346c28 Joerg Roedel   2016-04-08  264  		if (!amd_iommu_rlookup_table[pci_alias]) {
e3156048346c28 Joerg Roedel   2016-04-08  265  			amd_iommu_rlookup_table[pci_alias] =
e3156048346c28 Joerg Roedel   2016-04-08  266  				amd_iommu_rlookup_table[devid];
e3156048346c28 Joerg Roedel   2016-04-08  267  			memcpy(amd_iommu_dev_table[pci_alias].data,
e3156048346c28 Joerg Roedel   2016-04-08  268  			       amd_iommu_dev_table[devid].data,
e3156048346c28 Joerg Roedel   2016-04-08  269  			       sizeof(amd_iommu_dev_table[pci_alias].data));
e3156048346c28 Joerg Roedel   2016-04-08  270  		}
e3156048346c28 Joerg Roedel   2016-04-08  271  
e3156048346c28 Joerg Roedel   2016-04-08  272  		return pci_alias;
e3156048346c28 Joerg Roedel   2016-04-08  273  	}
e3156048346c28 Joerg Roedel   2016-04-08  274  
5f226da1b1d706 Bjorn Helgaas  2019-02-08  275  	pci_info(pdev, "Using IVRS reported alias %02x:%02x.%d "
5f226da1b1d706 Bjorn Helgaas  2019-02-08  276  		"for device [%04x:%04x], kernel reported alias "
e3156048346c28 Joerg Roedel   2016-04-08  277  		"%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias),
5f226da1b1d706 Bjorn Helgaas  2019-02-08  278  		PCI_FUNC(ivrs_alias), pdev->vendor, pdev->device,
e3156048346c28 Joerg Roedel   2016-04-08  279  		PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias),
e3156048346c28 Joerg Roedel   2016-04-08  280  		PCI_FUNC(pci_alias));
e3156048346c28 Joerg Roedel   2016-04-08  281  
e3156048346c28 Joerg Roedel   2016-04-08  282  	/*
e3156048346c28 Joerg Roedel   2016-04-08  283  	 * If we don't have a PCI DMA alias and the IVRS alias is on the same
e3156048346c28 Joerg Roedel   2016-04-08  284  	 * bus, then the IVRS table may know about a quirk that we don't.
e3156048346c28 Joerg Roedel   2016-04-08  285  	 */
e3156048346c28 Joerg Roedel   2016-04-08  286  	if (pci_alias == devid &&
e3156048346c28 Joerg Roedel   2016-04-08  287  	    PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) {
7afd16f882887c Linus Torvalds 2016-05-19 @288  		pci_add_dma_alias(pdev, ivrs_alias & 0xff);
5f226da1b1d706 Bjorn Helgaas  2019-02-08  289  		pci_info(pdev, "Added PCI DMA alias %02x.%d\n",
5f226da1b1d706 Bjorn Helgaas  2019-02-08  290  			PCI_SLOT(ivrs_alias), PCI_FUNC(ivrs_alias));
e3156048346c28 Joerg Roedel   2016-04-08  291  	}
e3156048346c28 Joerg Roedel   2016-04-08  292  
e3156048346c28 Joerg Roedel   2016-04-08  293  	return ivrs_alias;
e3156048346c28 Joerg Roedel   2016-04-08  294  }
e3156048346c28 Joerg Roedel   2016-04-08  295  

:::::: The code at line 288 was first introduced by commit
:::::: 7afd16f882887c9adc69cd1794f5e57777723217 Merge tag 'pci-v4.7-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

:::::: TO: Linus Torvalds <torvalds@...ux-foundation.org>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ