From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, John Garry <john.garry@huawei.com>,
joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
baolu.lu@linux.intel.com
Cc: kbuild-all@lists.01.org, lkp@intel.com, airlied@linux.ie,
linuxarm@huawei.com, jonathanh@nvidia.com,
iommu@lists.linux-foundation.org, thierry.reding@gmail.com,
daniel@ffwll.ch
Subject: Re: [PATCH v4 6/6] dma-iommu: Pass iova len for IOVA domain init
Date: Mon, 19 Jul 2021 10:58:09 +0300 [thread overview]
Message-ID: <202107150933.iNUojyx8-lkp@intel.com> (raw)
In-Reply-To: <1626259003-201303-7-git-send-email-john.garry@huawei.com>
Hi John,
url: https://github.com/0day-ci/linux/commits/John-Garry/iommu-Allow-IOVA-rcache-range-be-configured/20210714-184328
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: ia64-randconfig-m031-20210714 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/iommu/dma-iommu.c:384 iommu_dma_init_domain() warn: variable dereferenced before check 'dev' (see line 374)
vim +/dev +384 drivers/iommu/dma-iommu.c
06d60728ff5c01 Christoph Hellwig 2019-05-20 332 static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 333 dma_addr_t limit, struct device *dev)
0db2e5d18f76a6 Robin Murphy 2015-10-01 334 {
fdbe574eb69312 Robin Murphy 2017-01-19 335 struct iommu_dma_cookie *cookie = domain->iova_cookie;
c61a4633a56aaa Shaokun Zhang 2019-01-24 336 unsigned long order, base_pfn;
6b0c54e7f27159 Yunsheng Lin 2019-08-24 337 struct iova_domain *iovad;
de4ba360c3e4ed John Garry 2021-07-14 338 size_t max_opt_dma_size;
de4ba360c3e4ed John Garry 2021-07-14 339 unsigned long iova_len = 0;
0db2e5d18f76a6 Robin Murphy 2015-10-01 340
fdbe574eb69312 Robin Murphy 2017-01-19 341 if (!cookie || cookie->type != IOMMU_DMA_IOVA_COOKIE)
fdbe574eb69312 Robin Murphy 2017-01-19 342 return -EINVAL;
0db2e5d18f76a6 Robin Murphy 2015-10-01 343
6b0c54e7f27159 Yunsheng Lin 2019-08-24 344 iovad = &cookie->iovad;
6b0c54e7f27159 Yunsheng Lin 2019-08-24 345
0db2e5d18f76a6 Robin Murphy 2015-10-01 346 /* Use the smallest supported page size for IOVA granularity */
d16e0faab911cc Robin Murphy 2016-04-07 347 order = __ffs(domain->pgsize_bitmap);
0db2e5d18f76a6 Robin Murphy 2015-10-01 348 base_pfn = max_t(unsigned long, 1, base >> order);
0db2e5d18f76a6 Robin Murphy 2015-10-01 349
0db2e5d18f76a6 Robin Murphy 2015-10-01 350 /* Check the domain allows at least some access to the device... */
0db2e5d18f76a6 Robin Murphy 2015-10-01 351 if (domain->geometry.force_aperture) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 352 if (base > domain->geometry.aperture_end ||
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 353 limit < domain->geometry.aperture_start) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 354 pr_warn("specified DMA range outside IOMMU capability\n");
0db2e5d18f76a6 Robin Murphy 2015-10-01 355 return -EFAULT;
0db2e5d18f76a6 Robin Murphy 2015-10-01 356 }
0db2e5d18f76a6 Robin Murphy 2015-10-01 357 /* ...then finally give it a kicking to make sure it fits */
0db2e5d18f76a6 Robin Murphy 2015-10-01 358 base_pfn = max_t(unsigned long, base_pfn,
0db2e5d18f76a6 Robin Murphy 2015-10-01 359 domain->geometry.aperture_start >> order);
0db2e5d18f76a6 Robin Murphy 2015-10-01 360 }
0db2e5d18f76a6 Robin Murphy 2015-10-01 361
f51d7bb79c1124 Robin Murphy 2017-01-16 362 /* start_pfn is always nonzero for an already-initialised domain */
0db2e5d18f76a6 Robin Murphy 2015-10-01 363 if (iovad->start_pfn) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 364 if (1UL << order != iovad->granule ||
f51d7bb79c1124 Robin Murphy 2017-01-16 365 base_pfn != iovad->start_pfn) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 366 pr_warn("Incompatible range for DMA domain\n");
0db2e5d18f76a6 Robin Murphy 2015-10-01 367 return -EFAULT;
0db2e5d18f76a6 Robin Murphy 2015-10-01 368 }
7c1b058c8b5a31 Robin Murphy 2017-03-16 369
7c1b058c8b5a31 Robin Murphy 2017-03-16 370 return 0;
0db2e5d18f76a6 Robin Murphy 2015-10-01 371 }
7c1b058c8b5a31 Robin Murphy 2017-03-16 372
de4ba360c3e4ed John Garry 2021-07-14 373
de4ba360c3e4ed John Garry 2021-07-14 @374 max_opt_dma_size = iommu_group_get_max_opt_dma_size(dev->iommu_group);
^^^^^^^^^^^^^^^^
New unchecked dereference
de4ba360c3e4ed John Garry 2021-07-14 375 if (max_opt_dma_size) {
de4ba360c3e4ed John Garry 2021-07-14 376 unsigned long shift = __ffs(1UL << order);
de4ba360c3e4ed John Garry 2021-07-14 377
de4ba360c3e4ed John Garry 2021-07-14 378 iova_len = max_opt_dma_size >> shift;
de4ba360c3e4ed John Garry 2021-07-14 379 iova_len = roundup_pow_of_two(iova_len);
de4ba360c3e4ed John Garry 2021-07-14 380 }
de4ba360c3e4ed John Garry 2021-07-14 381
de4ba360c3e4ed John Garry 2021-07-14 382 init_iova_domain(iovad, 1UL << order, base_pfn, iova_len);
2da274cdf998a1 Zhen Lei 2018-09-20 383
82c3cefb9f1652 Lu Baolu 2021-02-25 @384 if (!cookie->fq_domain && (!dev || !dev_is_untrusted(dev)) &&
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a250c23f15c21c Robin Murphy 2021-04-01 385 domain->ops->flush_iotlb_all && !iommu_get_dma_strict(domain)) {
b34e9b0de3c411 Tom Murphy 2020-09-10 386 if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
2a2b8eaa5b2566 Tom Murphy 2020-11-24 387 iommu_dma_entry_dtor))
b34e9b0de3c411 Tom Murphy 2020-09-10 388 pr_warn("iova flush queue initialization failed\n");
b34e9b0de3c411 Tom Murphy 2020-09-10 389 else
2da274cdf998a1 Zhen Lei 2018-09-20 390 cookie->fq_domain = domain;
2da274cdf998a1 Zhen Lei 2018-09-20 391 }
2da274cdf998a1 Zhen Lei 2018-09-20 392
7c1b058c8b5a31 Robin Murphy 2017-03-16 393 if (!dev)
^^^^
Old code has checks for NULL
0db2e5d18f76a6 Robin Murphy 2015-10-01 394 return 0;
7c1b058c8b5a31 Robin Murphy 2017-03-16 395
7c1b058c8b5a31 Robin Murphy 2017-03-16 396 return iova_reserve_iommu_regions(dev, domain);
0db2e5d18f76a6 Robin Murphy 2015-10-01 397 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v4 6/6] dma-iommu: Pass iova len for IOVA domain init
Date: Thu, 15 Jul 2021 09:36:31 +0800 [thread overview]
Message-ID: <202107150933.iNUojyx8-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8704 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <1626259003-201303-7-git-send-email-john.garry@huawei.com>
References: <1626259003-201303-7-git-send-email-john.garry@huawei.com>
TO: John Garry <john.garry@huawei.com>
TO: joro(a)8bytes.org
TO: will(a)kernel.org
TO: robin.murphy(a)arm.com
TO: baolu.lu(a)linux.intel.com
CC: iommu(a)lists.linux-foundation.org
CC: linuxarm(a)huawei.com
CC: thierry.reding(a)gmail.com
CC: airlied(a)linux.ie
CC: daniel(a)ffwll.ch
CC: jonathanh(a)nvidia.com
Hi John,
I love your patch! Perhaps something to improve:
[auto build test WARNING on iommu/next]
[also build test WARNING on linuxtv-media/master tegra/for-next tegra-drm/drm/tegra/for-next linus/master v5.14-rc1 next-20210714]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/John-Garry/iommu-Allow-IOVA-rcache-range-be-configured/20210714-184328
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
:::::: branch date: 15 hours ago
:::::: commit date: 15 hours ago
config: ia64-randconfig-m031-20210714 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/iommu/dma-iommu.c:384 iommu_dma_init_domain() warn: variable dereferenced before check 'dev' (see line 374)
vim +/dev +384 drivers/iommu/dma-iommu.c
82c3cefb9f1652 Lu Baolu 2021-02-25 319
0db2e5d18f76a6 Robin Murphy 2015-10-01 320 /**
0db2e5d18f76a6 Robin Murphy 2015-10-01 321 * iommu_dma_init_domain - Initialise a DMA mapping domain
0db2e5d18f76a6 Robin Murphy 2015-10-01 322 * @domain: IOMMU domain previously prepared by iommu_get_dma_cookie()
0db2e5d18f76a6 Robin Murphy 2015-10-01 323 * @base: IOVA at which the mappable address space starts
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 324 * @limit: Last address of the IOVA space
fade1ec055dc6b Robin Murphy 2016-09-12 325 * @dev: Device the domain is being initialised for
0db2e5d18f76a6 Robin Murphy 2015-10-01 326 *
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 327 * @base and @limit + 1 should be exact multiples of IOMMU page granularity to
0db2e5d18f76a6 Robin Murphy 2015-10-01 328 * avoid rounding surprises. If necessary, we reserve the page at address 0
0db2e5d18f76a6 Robin Murphy 2015-10-01 329 * to ensure it is an invalid IOVA. It is safe to reinitialise a domain, but
0db2e5d18f76a6 Robin Murphy 2015-10-01 330 * any change which could make prior IOVAs invalid will fail.
0db2e5d18f76a6 Robin Murphy 2015-10-01 331 */
06d60728ff5c01 Christoph Hellwig 2019-05-20 332 static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 333 dma_addr_t limit, struct device *dev)
0db2e5d18f76a6 Robin Murphy 2015-10-01 334 {
fdbe574eb69312 Robin Murphy 2017-01-19 335 struct iommu_dma_cookie *cookie = domain->iova_cookie;
c61a4633a56aaa Shaokun Zhang 2019-01-24 336 unsigned long order, base_pfn;
6b0c54e7f27159 Yunsheng Lin 2019-08-24 337 struct iova_domain *iovad;
de4ba360c3e4ed John Garry 2021-07-14 338 size_t max_opt_dma_size;
de4ba360c3e4ed John Garry 2021-07-14 339 unsigned long iova_len = 0;
0db2e5d18f76a6 Robin Murphy 2015-10-01 340
fdbe574eb69312 Robin Murphy 2017-01-19 341 if (!cookie || cookie->type != IOMMU_DMA_IOVA_COOKIE)
fdbe574eb69312 Robin Murphy 2017-01-19 342 return -EINVAL;
0db2e5d18f76a6 Robin Murphy 2015-10-01 343
6b0c54e7f27159 Yunsheng Lin 2019-08-24 344 iovad = &cookie->iovad;
6b0c54e7f27159 Yunsheng Lin 2019-08-24 345
0db2e5d18f76a6 Robin Murphy 2015-10-01 346 /* Use the smallest supported page size for IOVA granularity */
d16e0faab911cc Robin Murphy 2016-04-07 347 order = __ffs(domain->pgsize_bitmap);
0db2e5d18f76a6 Robin Murphy 2015-10-01 348 base_pfn = max_t(unsigned long, 1, base >> order);
0db2e5d18f76a6 Robin Murphy 2015-10-01 349
0db2e5d18f76a6 Robin Murphy 2015-10-01 350 /* Check the domain allows at least some access to the device... */
0db2e5d18f76a6 Robin Murphy 2015-10-01 351 if (domain->geometry.force_aperture) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 352 if (base > domain->geometry.aperture_end ||
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 353 limit < domain->geometry.aperture_start) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 354 pr_warn("specified DMA range outside IOMMU capability\n");
0db2e5d18f76a6 Robin Murphy 2015-10-01 355 return -EFAULT;
0db2e5d18f76a6 Robin Murphy 2015-10-01 356 }
0db2e5d18f76a6 Robin Murphy 2015-10-01 357 /* ...then finally give it a kicking to make sure it fits */
0db2e5d18f76a6 Robin Murphy 2015-10-01 358 base_pfn = max_t(unsigned long, base_pfn,
0db2e5d18f76a6 Robin Murphy 2015-10-01 359 domain->geometry.aperture_start >> order);
0db2e5d18f76a6 Robin Murphy 2015-10-01 360 }
0db2e5d18f76a6 Robin Murphy 2015-10-01 361
f51d7bb79c1124 Robin Murphy 2017-01-16 362 /* start_pfn is always nonzero for an already-initialised domain */
0db2e5d18f76a6 Robin Murphy 2015-10-01 363 if (iovad->start_pfn) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 364 if (1UL << order != iovad->granule ||
f51d7bb79c1124 Robin Murphy 2017-01-16 365 base_pfn != iovad->start_pfn) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 366 pr_warn("Incompatible range for DMA domain\n");
0db2e5d18f76a6 Robin Murphy 2015-10-01 367 return -EFAULT;
0db2e5d18f76a6 Robin Murphy 2015-10-01 368 }
7c1b058c8b5a31 Robin Murphy 2017-03-16 369
7c1b058c8b5a31 Robin Murphy 2017-03-16 370 return 0;
0db2e5d18f76a6 Robin Murphy 2015-10-01 371 }
7c1b058c8b5a31 Robin Murphy 2017-03-16 372
de4ba360c3e4ed John Garry 2021-07-14 373
de4ba360c3e4ed John Garry 2021-07-14 @374 max_opt_dma_size = iommu_group_get_max_opt_dma_size(dev->iommu_group);
de4ba360c3e4ed John Garry 2021-07-14 375 if (max_opt_dma_size) {
de4ba360c3e4ed John Garry 2021-07-14 376 unsigned long shift = __ffs(1UL << order);
de4ba360c3e4ed John Garry 2021-07-14 377
de4ba360c3e4ed John Garry 2021-07-14 378 iova_len = max_opt_dma_size >> shift;
de4ba360c3e4ed John Garry 2021-07-14 379 iova_len = roundup_pow_of_two(iova_len);
de4ba360c3e4ed John Garry 2021-07-14 380 }
de4ba360c3e4ed John Garry 2021-07-14 381
de4ba360c3e4ed John Garry 2021-07-14 382 init_iova_domain(iovad, 1UL << order, base_pfn, iova_len);
2da274cdf998a1 Zhen Lei 2018-09-20 383
82c3cefb9f1652 Lu Baolu 2021-02-25 @384 if (!cookie->fq_domain && (!dev || !dev_is_untrusted(dev)) &&
a250c23f15c21c Robin Murphy 2021-04-01 385 domain->ops->flush_iotlb_all && !iommu_get_dma_strict(domain)) {
b34e9b0de3c411 Tom Murphy 2020-09-10 386 if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
2a2b8eaa5b2566 Tom Murphy 2020-11-24 387 iommu_dma_entry_dtor))
b34e9b0de3c411 Tom Murphy 2020-09-10 388 pr_warn("iova flush queue initialization failed\n");
b34e9b0de3c411 Tom Murphy 2020-09-10 389 else
2da274cdf998a1 Zhen Lei 2018-09-20 390 cookie->fq_domain = domain;
2da274cdf998a1 Zhen Lei 2018-09-20 391 }
2da274cdf998a1 Zhen Lei 2018-09-20 392
7c1b058c8b5a31 Robin Murphy 2017-03-16 393 if (!dev)
0db2e5d18f76a6 Robin Murphy 2015-10-01 394 return 0;
7c1b058c8b5a31 Robin Murphy 2017-03-16 395
7c1b058c8b5a31 Robin Murphy 2017-03-16 396 return iova_reserve_iommu_regions(dev, domain);
0db2e5d18f76a6 Robin Murphy 2015-10-01 397 }
0db2e5d18f76a6 Robin Murphy 2015-10-01 398
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36406 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v4 6/6] dma-iommu: Pass iova len for IOVA domain init
Date: Mon, 19 Jul 2021 10:58:09 +0300 [thread overview]
Message-ID: <202107150933.iNUojyx8-lkp@intel.com> (raw)
In-Reply-To: <1626259003-201303-7-git-send-email-john.garry@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 6735 bytes --]
Hi John,
url: https://github.com/0day-ci/linux/commits/John-Garry/iommu-Allow-IOVA-rcache-range-be-configured/20210714-184328
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: ia64-randconfig-m031-20210714 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/iommu/dma-iommu.c:384 iommu_dma_init_domain() warn: variable dereferenced before check 'dev' (see line 374)
vim +/dev +384 drivers/iommu/dma-iommu.c
06d60728ff5c01 Christoph Hellwig 2019-05-20 332 static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 333 dma_addr_t limit, struct device *dev)
0db2e5d18f76a6 Robin Murphy 2015-10-01 334 {
fdbe574eb69312 Robin Murphy 2017-01-19 335 struct iommu_dma_cookie *cookie = domain->iova_cookie;
c61a4633a56aaa Shaokun Zhang 2019-01-24 336 unsigned long order, base_pfn;
6b0c54e7f27159 Yunsheng Lin 2019-08-24 337 struct iova_domain *iovad;
de4ba360c3e4ed John Garry 2021-07-14 338 size_t max_opt_dma_size;
de4ba360c3e4ed John Garry 2021-07-14 339 unsigned long iova_len = 0;
0db2e5d18f76a6 Robin Murphy 2015-10-01 340
fdbe574eb69312 Robin Murphy 2017-01-19 341 if (!cookie || cookie->type != IOMMU_DMA_IOVA_COOKIE)
fdbe574eb69312 Robin Murphy 2017-01-19 342 return -EINVAL;
0db2e5d18f76a6 Robin Murphy 2015-10-01 343
6b0c54e7f27159 Yunsheng Lin 2019-08-24 344 iovad = &cookie->iovad;
6b0c54e7f27159 Yunsheng Lin 2019-08-24 345
0db2e5d18f76a6 Robin Murphy 2015-10-01 346 /* Use the smallest supported page size for IOVA granularity */
d16e0faab911cc Robin Murphy 2016-04-07 347 order = __ffs(domain->pgsize_bitmap);
0db2e5d18f76a6 Robin Murphy 2015-10-01 348 base_pfn = max_t(unsigned long, 1, base >> order);
0db2e5d18f76a6 Robin Murphy 2015-10-01 349
0db2e5d18f76a6 Robin Murphy 2015-10-01 350 /* Check the domain allows at least some access to the device... */
0db2e5d18f76a6 Robin Murphy 2015-10-01 351 if (domain->geometry.force_aperture) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 352 if (base > domain->geometry.aperture_end ||
ac6d704679d343 Jean-Philippe Brucker 2021-06-18 353 limit < domain->geometry.aperture_start) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 354 pr_warn("specified DMA range outside IOMMU capability\n");
0db2e5d18f76a6 Robin Murphy 2015-10-01 355 return -EFAULT;
0db2e5d18f76a6 Robin Murphy 2015-10-01 356 }
0db2e5d18f76a6 Robin Murphy 2015-10-01 357 /* ...then finally give it a kicking to make sure it fits */
0db2e5d18f76a6 Robin Murphy 2015-10-01 358 base_pfn = max_t(unsigned long, base_pfn,
0db2e5d18f76a6 Robin Murphy 2015-10-01 359 domain->geometry.aperture_start >> order);
0db2e5d18f76a6 Robin Murphy 2015-10-01 360 }
0db2e5d18f76a6 Robin Murphy 2015-10-01 361
f51d7bb79c1124 Robin Murphy 2017-01-16 362 /* start_pfn is always nonzero for an already-initialised domain */
0db2e5d18f76a6 Robin Murphy 2015-10-01 363 if (iovad->start_pfn) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 364 if (1UL << order != iovad->granule ||
f51d7bb79c1124 Robin Murphy 2017-01-16 365 base_pfn != iovad->start_pfn) {
0db2e5d18f76a6 Robin Murphy 2015-10-01 366 pr_warn("Incompatible range for DMA domain\n");
0db2e5d18f76a6 Robin Murphy 2015-10-01 367 return -EFAULT;
0db2e5d18f76a6 Robin Murphy 2015-10-01 368 }
7c1b058c8b5a31 Robin Murphy 2017-03-16 369
7c1b058c8b5a31 Robin Murphy 2017-03-16 370 return 0;
0db2e5d18f76a6 Robin Murphy 2015-10-01 371 }
7c1b058c8b5a31 Robin Murphy 2017-03-16 372
de4ba360c3e4ed John Garry 2021-07-14 373
de4ba360c3e4ed John Garry 2021-07-14 @374 max_opt_dma_size = iommu_group_get_max_opt_dma_size(dev->iommu_group);
^^^^^^^^^^^^^^^^
New unchecked dereference
de4ba360c3e4ed John Garry 2021-07-14 375 if (max_opt_dma_size) {
de4ba360c3e4ed John Garry 2021-07-14 376 unsigned long shift = __ffs(1UL << order);
de4ba360c3e4ed John Garry 2021-07-14 377
de4ba360c3e4ed John Garry 2021-07-14 378 iova_len = max_opt_dma_size >> shift;
de4ba360c3e4ed John Garry 2021-07-14 379 iova_len = roundup_pow_of_two(iova_len);
de4ba360c3e4ed John Garry 2021-07-14 380 }
de4ba360c3e4ed John Garry 2021-07-14 381
de4ba360c3e4ed John Garry 2021-07-14 382 init_iova_domain(iovad, 1UL << order, base_pfn, iova_len);
2da274cdf998a1 Zhen Lei 2018-09-20 383
82c3cefb9f1652 Lu Baolu 2021-02-25 @384 if (!cookie->fq_domain && (!dev || !dev_is_untrusted(dev)) &&
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a250c23f15c21c Robin Murphy 2021-04-01 385 domain->ops->flush_iotlb_all && !iommu_get_dma_strict(domain)) {
b34e9b0de3c411 Tom Murphy 2020-09-10 386 if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
2a2b8eaa5b2566 Tom Murphy 2020-11-24 387 iommu_dma_entry_dtor))
b34e9b0de3c411 Tom Murphy 2020-09-10 388 pr_warn("iova flush queue initialization failed\n");
b34e9b0de3c411 Tom Murphy 2020-09-10 389 else
2da274cdf998a1 Zhen Lei 2018-09-20 390 cookie->fq_domain = domain;
2da274cdf998a1 Zhen Lei 2018-09-20 391 }
2da274cdf998a1 Zhen Lei 2018-09-20 392
7c1b058c8b5a31 Robin Murphy 2017-03-16 393 if (!dev)
^^^^
Old code has checks for NULL
0db2e5d18f76a6 Robin Murphy 2015-10-01 394 return 0;
7c1b058c8b5a31 Robin Murphy 2017-03-16 395
7c1b058c8b5a31 Robin Murphy 2017-03-16 396 return iova_reserve_iommu_regions(dev, domain);
0db2e5d18f76a6 Robin Murphy 2015-10-01 397 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next parent reply other threads:[~2021-07-19 7:59 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 1:36 kernel test robot [this message]
2021-07-19 7:58 ` [PATCH v4 6/6] dma-iommu: Pass iova len for IOVA domain init Dan Carpenter
2021-07-19 7:58 ` Dan Carpenter
2021-07-19 9:12 ` John Garry
2021-07-19 9:12 ` John Garry
2021-07-19 9:32 ` Robin Murphy
2021-07-19 9:32 ` Robin Murphy
2021-07-19 10:45 ` John Garry
2021-07-19 10:45 ` John Garry
-- strict thread matches above, loose matches on Subject: below --
2021-07-14 10:36 [PATCH v4 0/6] iommu: Allow IOVA rcache range be configured John Garry
2021-07-14 10:36 ` John Garry
2021-07-14 10:36 ` [PATCH v4 1/6] iommu: Refactor iommu_group_store_type() John Garry
2021-07-14 10:36 ` John Garry
2021-08-02 14:46 ` Will Deacon
2021-08-02 14:46 ` Will Deacon
2021-07-14 10:36 ` [PATCH v4 2/6] iova: Allow rcache range upper limit to be flexible John Garry
2021-07-14 10:36 ` John Garry
2021-08-02 15:01 ` Will Deacon
2021-08-02 15:01 ` Will Deacon
2021-08-02 15:23 ` John Garry
2021-08-02 15:23 ` John Garry
2021-08-02 16:09 ` Robin Murphy
2021-08-02 16:09 ` Robin Murphy
2021-07-14 10:36 ` [PATCH v4 3/6] iommu: Allow iommu_change_dev_def_domain() realloc default domain for same type John Garry
2021-07-14 10:36 ` John Garry
2021-07-14 10:36 ` [PATCH v4 4/6] iommu: Allow max opt DMA len be set for a group via sysfs John Garry
2021-07-14 10:36 ` John Garry
2021-07-14 10:36 ` [PATCH v4 5/6] iova: Add iova_len argument to init_iova_domain() John Garry
2021-07-14 10:36 ` John Garry
2021-08-02 15:06 ` Will Deacon
2021-08-02 15:06 ` Will Deacon
2021-08-02 16:06 ` John Garry
2021-08-02 16:06 ` John Garry
2021-08-02 16:16 ` Robin Murphy
2021-08-02 16:16 ` Robin Murphy
2021-08-02 16:40 ` John Garry
2021-08-02 16:40 ` John Garry
2021-08-02 17:18 ` John Garry
2021-08-02 17:18 ` John Garry
2021-09-21 8:48 ` John Garry
2021-09-21 8:48 ` John Garry
2021-07-14 10:36 ` [PATCH v4 6/6] dma-iommu: Pass iova len for IOVA domain init John Garry
2021-07-14 10:36 ` John Garry
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=202107150933.iNUojyx8-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=airlied@linux.ie \
--cc=baolu.lu@linux.intel.com \
--cc=daniel@ffwll.ch \
--cc=iommu@lists.linux-foundation.org \
--cc=john.garry@huawei.com \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linuxarm@huawei.com \
--cc=lkp@intel.com \
--cc=robin.murphy@arm.com \
--cc=thierry.reding@gmail.com \
--cc=will@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 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.