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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 10 Oct 2022 09:25:57 +0800
From:   kernel test robot <lkp@...el.com>
To:     Shiyang Ruan <ruansy.fnst@...itsu.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Christoph Hellwig <hch@....de>,
        "Darrick J. Wong" <djwong@...nel.org>
Subject: fs/dax.c:1087:23: sparse: sparse: Using plain integer as NULL pointer

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   493ffd6605b2d3d4dc7008ab927dba319f36671f
commit: ff17b8df224b98e282ec39a9949a3672fa3dbe93 fsdax: introduce dax_iomap_cow_copy()
date:   3 months ago
config: arm64-randconfig-s042-20221009
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ff17b8df224b98e282ec39a9949a3672fa3dbe93
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout ff17b8df224b98e282ec39a9949a3672fa3dbe93
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

sparse warnings: (new ones prefixed by >>)
   fs/dax.c:658:39: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned long v @@     got restricted vm_fault_t @@
   fs/dax.c:658:39: sparse:     expected unsigned long v
   fs/dax.c:658:39: sparse:     got restricted vm_fault_t
   fs/dax.c:660:39: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned long v @@     got restricted vm_fault_t @@
   fs/dax.c:660:39: sparse:     expected unsigned long v
   fs/dax.c:660:39: sparse:     got restricted vm_fault_t
   fs/dax.c:664:31: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned long v @@     got restricted vm_fault_t @@
   fs/dax.c:664:31: sparse:     expected unsigned long v
   fs/dax.c:664:31: sparse:     got restricted vm_fault_t
>> fs/dax.c:1087:23: sparse: sparse: Using plain integer as NULL pointer
   fs/dax.c:1139:41: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int result @@     got restricted vm_fault_t [assigned] [usertype] ret @@
   fs/dax.c:1139:41: sparse:     expected int result
   fs/dax.c:1139:41: sparse:     got restricted vm_fault_t [assigned] [usertype] ret
   fs/dax.c:1580:46: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int result @@     got restricted vm_fault_t [usertype] ret @@
   fs/dax.c:1580:46: sparse:     expected int result
   fs/dax.c:1580:46: sparse:     got restricted vm_fault_t [usertype] ret
   fs/dax.c:1596:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted vm_fault_t [assigned] [usertype] ret @@     got unsigned long @@
   fs/dax.c:1596:21: sparse:     expected restricted vm_fault_t [assigned] [usertype] ret
   fs/dax.c:1596:21: sparse:     got unsigned long
   fs/dax.c:1637:51: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int result @@     got restricted vm_fault_t [assigned] [usertype] ret @@
   fs/dax.c:1637:51: sparse:     expected int result
   fs/dax.c:1637:51: sparse:     got restricted vm_fault_t [assigned] [usertype] ret
   fs/dax.c:1718:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted vm_fault_t [assigned] [usertype] ret @@     got unsigned long @@
   fs/dax.c:1718:21: sparse:     expected restricted vm_fault_t [assigned] [usertype] ret
   fs/dax.c:1718:21: sparse:     got unsigned long
   fs/dax.c:1752:62: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected int result @@     got restricted vm_fault_t [assigned] [usertype] ret @@
   fs/dax.c:1752:62: sparse:     expected int result
   fs/dax.c:1752:62: sparse:     got restricted vm_fault_t [assigned] [usertype] ret
   fs/dax.c:1815:55: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int result @@     got restricted vm_fault_t @@
   fs/dax.c:1815:55: sparse:     expected int result
   fs/dax.c:1815:55: sparse:     got restricted vm_fault_t
   fs/dax.c:1830:58: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int result @@     got restricted vm_fault_t [assigned] [usertype] ret @@
   fs/dax.c:1830:58: sparse:     expected int result
   fs/dax.c:1830:58: sparse:     got restricted vm_fault_t [assigned] [usertype] ret
   fs/dax.c:257:13: sparse: sparse: context imbalance in 'wait_entry_unlocked' - unexpected unlock
   fs/dax.c:439:49: sparse: sparse: context imbalance in 'dax_lock_page' - different lock contexts for basic block
   fs/dax.c:506:17: sparse: sparse: context imbalance in 'dax_lock_mapping_entry' - different lock contexts for basic block
   fs/dax.c:930:9: sparse: sparse: context imbalance in 'dax_writeback_one' - unexpected unlock

vim +1087 fs/dax.c

  1064	
  1065	/**
  1066	 * dax_iomap_cow_copy - Copy the data from source to destination before write
  1067	 * @pos:	address to do copy from.
  1068	 * @length:	size of copy operation.
  1069	 * @align_size:	aligned w.r.t align_size (either PMD_SIZE or PAGE_SIZE)
  1070	 * @srcmap:	iomap srcmap
  1071	 * @daddr:	destination address to copy to.
  1072	 *
  1073	 * This can be called from two places. Either during DAX write fault (page
  1074	 * aligned), to copy the length size data to daddr. Or, while doing normal DAX
  1075	 * write operation, dax_iomap_actor() might call this to do the copy of either
  1076	 * start or end unaligned address. In the latter case the rest of the copy of
  1077	 * aligned ranges is taken care by dax_iomap_actor() itself.
  1078	 */
  1079	static int dax_iomap_cow_copy(loff_t pos, uint64_t length, size_t align_size,
  1080			const struct iomap *srcmap, void *daddr)
  1081	{
  1082		loff_t head_off = pos & (align_size - 1);
  1083		size_t size = ALIGN(head_off + length, align_size);
  1084		loff_t end = pos + length;
  1085		loff_t pg_end = round_up(end, align_size);
  1086		bool copy_all = head_off == 0 && end == pg_end;
> 1087		void *saddr = 0;
  1088		int ret = 0;
  1089	
  1090		ret = dax_iomap_direct_access(srcmap, pos, size, &saddr, NULL);
  1091		if (ret)
  1092			return ret;
  1093	
  1094		if (copy_all) {
  1095			ret = copy_mc_to_kernel(daddr, saddr, length);
  1096			return ret ? -EIO : 0;
  1097		}
  1098	
  1099		/* Copy the head part of the range */
  1100		if (head_off) {
  1101			ret = copy_mc_to_kernel(daddr, saddr, head_off);
  1102			if (ret)
  1103				return -EIO;
  1104		}
  1105	
  1106		/* Copy the tail part of the range */
  1107		if (end < pg_end) {
  1108			loff_t tail_off = head_off + length;
  1109			loff_t tail_len = pg_end - end;
  1110	
  1111			ret = copy_mc_to_kernel(daddr + tail_off, saddr + tail_off,
  1112						tail_len);
  1113			if (ret)
  1114				return -EIO;
  1115		}
  1116		return 0;
  1117	}
  1118	

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

View attachment "config" of type "text/plain" (173166 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ