iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Keqian Zhu <zhukeqian1@huawei.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org, kvm@vger.kernel.org,
	kvmarm@lists.cs.columbia.edu,
	Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>, Marc Zyngier <maz@kernel.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>
Cc: kbuild-all@lists.01.org, lkp@intel.com
Subject: [kbuild] Re: [PATCH 1/7] vfio: iommu_type1: Clear added dirty bit when unwind pin
Date: Wed, 16 Dec 2020 10:22:25 +0300	[thread overview]
Message-ID: <20201216072225.GE2831@kadam> (raw)
In-Reply-To: <20201210073425.25960-2-zhukeqian1@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 2928 bytes --]

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 

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38446 bytes --]

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

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

[-- Attachment #4: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2020-12-16  7:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10  7:34 [PATCH 0/7] vfio: iommu_type1: Some fixes and optimization Keqian Zhu
2020-12-10  7:34 ` [PATCH 1/7] vfio: iommu_type1: Clear added dirty bit when unwind pin Keqian Zhu
2020-12-10 19:16   ` Alex Williamson
2020-12-11  6:51     ` zhukeqian
2020-12-15  0:16       ` Alex Williamson
2020-12-16  7:22   ` Dan Carpenter [this message]
2020-12-10  7:34 ` [PATCH 2/7] vfio: iommu_type1: Initially set the pinned_page_dirty_scope Keqian Zhu
2020-12-10  7:34 ` [PATCH 3/7] vfio: iommu_type1: Make an explicit "promote" semantic Keqian Zhu
2020-12-10  7:34 ` [PATCH 4/7] vfio: iommu_type1: Fix missing dirty page when promote pinned_scope Keqian Zhu
2020-12-15  0:04   ` Alex Williamson
2020-12-15  9:37     ` zhukeqian
2020-12-15 15:53       ` Alex Williamson
2020-12-18  8:21         ` Keqian Zhu
2020-12-10  7:34 ` [PATCH 5/7] vfio: iommu_type1: Drop parameter "pgsize" of vfio_dma_bitmap_alloc_all Keqian Zhu
2020-12-10  7:34 ` [PATCH 6/7] vfio: iommu_type1: Drop parameter "pgsize" of vfio_iova_dirty_bitmap Keqian Zhu
2020-12-10  7:34 ` [PATCH 7/7] vfio: iommu_type1: Drop parameter "pgsize" of update_user_bitmap Keqian Zhu

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=20201216072225.GE2831@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=maz@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=zhukeqian1@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).