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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 24 Aug 2020 13:37:56 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, FelixCuioc <FelixCui-oc@...oxin.com>,
        Joerg Roedel <joro@...tes.org>,
        iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
        David Woodhouse <dwmw2@...radead.org>,
        Lu Baolu <baolu.lu@...ux.intel.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org, CobeChen-oc@...oxin.com,
        RaymondPang-oc@...oxin.com
Subject: Re: [PATCH] iommu/vt-d:Add support for probing ACPI device in RMRR

Hi FelixCuioc,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/FelixCuioc/iommu-vt-d-Add-support-for-probing-ACPI-device-in-RMRR/20200818-104920
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: x86_64-randconfig-m001-20200820 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

New smatch warnings:
drivers/iommu/intel/iommu.c:4850 probe_acpi_namespace_devices() warn: inconsistent returns 'adev->physical_node_lock'.

Old smatch warnings:
drivers/iommu/intel/iommu.c:836 device_to_iommu() error: we previously assumed 'pdev' could be null (see line 809)
drivers/iommu/intel/iommu.c:2272 __domain_mapping() error: we previously assumed 'sg' could be null (see line 2263)
drivers/iommu/intel/iommu.c:4371 intel_iommu_add() warn: should '(1 << sp)' be a 64 bit type?

# https://github.com/0day-ci/linux/commit/3adfd53a32c52833a34033fabaa5c1e65dfca688
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review FelixCuioc/iommu-vt-d-Add-support-for-probing-ACPI-device-in-RMRR/20200818-104920
git checkout 3adfd53a32c52833a34033fabaa5c1e65dfca688
vim +4850 drivers/iommu/intel/iommu.c

fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4797  static int __init probe_acpi_namespace_devices(void)
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4798  {
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4799  	struct dmar_drhd_unit *drhd;
af88ec3962010e3 drivers/iommu/intel-iommu.c Qian Cai   2019-06-03  4800  	/* To avoid a -Wunused-but-set-variable warning. */
af88ec3962010e3 drivers/iommu/intel-iommu.c Qian Cai   2019-06-03  4801  	struct intel_iommu *iommu __maybe_unused;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4802  	struct device *dev;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4803  	int i, ret = 0;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4804  
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4805  	for_each_active_iommu(iommu, drhd) {
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4806  		for_each_active_dev_scope(drhd->devices,
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4807  					  drhd->devices_cnt, i, dev) {
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4808  			struct acpi_device_physical_node *pn;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4809  			struct iommu_group *group;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4810  			struct acpi_device *adev;
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4811  			struct device *pn_dev = NULL;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4812  
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4813  			if (dev->bus != &acpi_bus_type)
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4814  				continue;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4815  
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4816  			adev = to_acpi_device(dev);
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4817  			mutex_lock(&adev->physical_node_lock);
                                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4818  			list_for_each_entry(pn,
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4819  					    &adev->physical_node_list, node) {
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4820  				group = iommu_group_get(pn->dev);
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4821  				if (group) {
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4822  					pn_dev = pn->dev;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4823  					iommu_group_put(group);
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4824  					continue;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4825  				}
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4826  
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4827  				pn->dev->bus->iommu_ops = &intel_iommu_ops;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4828  				ret = iommu_probe_device(pn->dev);
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4829  				if (ret)
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4830  					break;
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4831  				pn_dev = pn->dev;
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4832  			}
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4833  			if (pn_dev == NULL) {
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4834  				dev->bus->iommu_ops = &intel_iommu_ops;
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4835  				ret = iommu_probe_device(dev);
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4836  				if (ret) {
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4837  					pr_err("acpi_device probe fail! ret:%d\n", ret);
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4838  					return ret;

Need to unlock.

3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4839  				}
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4840  				return 0;

Here too.

fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4841  			}
3adfd53a32c5283 drivers/iommu/intel/iommu.c FelixCuioc 2020-08-17  4842  			ret = acpi_device_create_direct_mappings(pn_dev, dev);
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4843  			mutex_unlock(&adev->physical_node_lock);
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4844  
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4845  			if (ret)
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4846  				return ret;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4847  		}
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4848  	}
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4849  
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25 @4850  	return 0;
fa212a97f3a366a drivers/iommu/intel-iommu.c Lu Baolu   2019-05-25  4851  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (36016 bytes)

Powered by blists - more mailing lists