public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Cc: kbuild-all@lists.01.org, linux-block@vger.kernel.org,
	bostroesser@gmail.com
Subject: Re: [PATCH v2] scsi: target: tcmu: Fix possible data corruption
Date: Tue, 12 Apr 2022 14:33:56 +0800	[thread overview]
Message-ID: <202204121450.qYzuKGXT-lkp@intel.com> (raw)
In-Reply-To: <20220411135958.21385-1-xiaoguang.wang@linux.alibaba.com>

Hi Xiaoguang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on v5.18-rc2 next-20220411]
[cannot apply to mkp-scsi/for-next]
[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/intel-lab-lkp/linux/commits/Xiaoguang-Wang/scsi-target-tcmu-Fix-possible-data-corruption/20220411-220214
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-rhel-8.3-kselftests (https://download.01.org/0day-ci/archive/20220412/202204121450.qYzuKGXT-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/intel-lab-lkp/linux/commit/2bceb529129db286e111bc3bae0b52b62b1fba07
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Xiaoguang-Wang/scsi-target-tcmu-Fix-possible-data-corruption/20220411-220214
        git checkout 2bceb529129db286e111bc3bae0b52b62b1fba07
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/target/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_user.c:1907:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected int ret @@     got restricted vm_fault_t @@
   drivers/target/target_core_user.c:1907:21: sparse:     expected int ret
   drivers/target/target_core_user.c:1907:21: sparse:     got restricted vm_fault_t
>> drivers/target/target_core_user.c:1911:16: sparse: sparse: incorrect type in return expression (different base types) @@     expected restricted vm_fault_t @@     got int ret @@
   drivers/target/target_core_user.c:1911:16: sparse:     expected restricted vm_fault_t
   drivers/target/target_core_user.c:1911:16: sparse:     got int ret

vim +1907 drivers/target/target_core_user.c

  1874	
  1875	static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf)
  1876	{
  1877		struct tcmu_dev *udev = vmf->vma->vm_private_data;
  1878		struct uio_info *info = &udev->uio_info;
  1879		struct page *page;
  1880		unsigned long offset;
  1881		void *addr;
  1882		int ret = 0;
  1883	
  1884		int mi = tcmu_find_mem_index(vmf->vma);
  1885		if (mi < 0)
  1886			return VM_FAULT_SIGBUS;
  1887	
  1888		/*
  1889		 * We need to subtract mi because userspace uses offset = N*PAGE_SIZE
  1890		 * to use mem[N].
  1891		 */
  1892		offset = (vmf->pgoff - mi) << PAGE_SHIFT;
  1893	
  1894		if (offset < udev->data_off) {
  1895			/* For the vmalloc()ed cmd area pages */
  1896			addr = (void *)(unsigned long)info->mem[mi].addr + offset;
  1897			page = vmalloc_to_page(addr);
  1898			get_page(page);
  1899		} else {
  1900			uint32_t dpi;
  1901	
  1902			/* For the dynamically growing data area pages */
  1903			dpi = (offset - udev->data_off) / PAGE_SIZE;
  1904			page = tcmu_try_get_data_page(udev, dpi);
  1905			if (!page)
  1906				return VM_FAULT_SIGBUS;
> 1907			ret = VM_FAULT_LOCKED;
  1908		}
  1909	
  1910		vmf->page = page;
> 1911		return ret;
  1912	}
  1913	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

  reply	other threads:[~2022-04-12  6:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 13:59 [PATCH v2] scsi: target: tcmu: Fix possible data corruption Xiaoguang Wang
2022-04-12  6:33 ` kernel test robot [this message]
2022-04-14  3:08   ` Xiaoguang Wang
2022-04-15 11:30 ` Bodo Stroesser
2022-04-15 15:02   ` Xiaoguang Wang

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=202204121450.qYzuKGXT-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bostroesser@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    --cc=xiaoguang.wang@linux.alibaba.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