lkml.org 
[lkml]   [2020]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[kbuild] Re: [PATCH 1/7] vfio: iommu_type1: Clear added dirty bit when unwind pin
Hi Keqian,

url: https://github.com/0day-ci/linux/commits/Keqian-Zhu/vfio-iommu_type1-Some-fixes-and-optimization/20201210-154322
base: https://github.com/awilliam/linux-vfio.git next
config: x86_64-randconfig-m001-20201215 (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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/vfio/vfio_iommu_type1.c:648 vfio_iommu_type1_pin_pages() warn: variable dereferenced before check 'iommu' (see line 640)

vim +/iommu +648 drivers/vfio/vfio_iommu_type1.c

a54eb55045ae9b3 Kirti Wankhede 2016-11-17 631 static int vfio_iommu_type1_pin_pages(void *iommu_data,
95fc87b44104d9a Kirti Wankhede 2020-05-29 632 struct iommu_group *iommu_group,
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 633 unsigned long *user_pfn,
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 634 int npage, int prot,
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 635 unsigned long *phys_pfn)
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 636 {
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 637 struct vfio_iommu *iommu = iommu_data;
95fc87b44104d9a Kirti Wankhede 2020-05-29 638 struct vfio_group *group;
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 639 int i, j, ret;
2b172c0ea2a6daf Keqian Zhu 2020-12-10 @640 unsigned long pgshift = __ffs(iommu->pgsize_bitmap);
^^^^^^^^^^^^^^^^^^^^
The patch introduces a new dereference.

a54eb55045ae9b3 Kirti Wankhede 2016-11-17 641 unsigned long remote_vaddr;
2b172c0ea2a6daf Keqian Zhu 2020-12-10 642 unsigned long bitmap_offset;
2b172c0ea2a6daf Keqian Zhu 2020-12-10 643 unsigned long *bitmap_added;
2b172c0ea2a6daf Keqian Zhu 2020-12-10 644 dma_addr_t iova;
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 645 struct vfio_dma *dma;
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 646 bool do_accounting;
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 647
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 @648 if (!iommu || !user_pfn || !phys_pfn)
^^^^^^
Checked too late.

a54eb55045ae9b3 Kirti Wankhede 2016-11-17 649 return -EINVAL;
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 650
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 651 /* Supported for v2 version only */
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 652 if (!iommu->v2)
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 653 return -EACCES;
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 654
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 655 mutex_lock(&iommu->lock);
a54eb55045ae9b3 Kirti Wankhede 2016-11-17 656

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
\
 
 \ /
  Last update: 2020-12-16 08:25    [W:0.095 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site