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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 Dec 2020 10:22:25 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Keqian Zhu <zhukeqian1@...wei.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        iommu@...ts.linux-foundation.org, kvm@...r.kernel.org,
        kvmarm@...ts.cs.columbia.edu,
        Alex Williamson <alex.williamson@...hat.com>,
        Cornelia Huck <cohuck@...hat.com>,
        Marc Zyngier <maz@...nel.org>, Will Deacon <will@...nel.org>,
        Robin Murphy <robin.murphy@....com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org
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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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 

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

_______________________________________________
kbuild mailing list -- kbuild@...ts.01.org
To unsubscribe send an email to kbuild-leave@...ts.01.org

Powered by blists - more mailing lists