Re: fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
From: Gao Xiang
Date: Fri Aug 07 2020 - 10:48:28 EST
Hi,
On Fri, Aug 07, 2020 at 08:08:10PM +0800, kernel test robot wrote:
> Hi Gao,
>
> First bad commit (maybe != root cause):
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 86cfccb66937dd6cbf26ed619958b9e587e6a115
> commit: 47e4937a4a7ca4184fd282791dfee76c6799966a erofs: move erofs out of staging
> date: 12 months ago
> config: s390-randconfig-s032-20200807 (attached as .config)
> compiler: s390-linux-gcc (GCC) 9.3.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.2-118-ge1578773-dirty
> git checkout 47e4937a4a7ca4184fd282791dfee76c6799966a
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
>
> sparse warnings: (new ones prefixed by >>)
>
> >> fs/erofs/zdata.c:198:22: sparse: sparse: non size-preserving integer to pointer cast
> fs/erofs/zdata.c:282:22: sparse: sparse: non size-preserving integer to pointer cast
> fs/erofs/zdata.c:1094:24: sparse: sparse: non size-preserving integer to pointer cast
I don't think these are valid warnings.
All these three lines are using cmpxchg struct page * (which is equivalent to unsigned long
in these cmpxchg macros) and nothing special at all in my opinion (Especially the last two
lines).
+198 if (!cmpxchg_relaxed(pages, NULL, tagptr_cast_ptr(t)))
+282 if (!cmpxchg(clt->compressedpages++, NULL, page))
+1094 if (oldpage != cmpxchg(&pcl->compressed_pages[nr], oldpage, page)) {
btw, recently sparse warnings quite confuse me (p.s. they're all on alpha/s390/sparc archs and relate
to cmpxchg/xchg by accident), I have no idea what happened with sparse.
Thanks,
Gao Xiang