[dhowells-fs:netfs-folio-regions 18/36] fs/netfs/write_helper.c:25:26: warning: comparison of distinct pointer types ('typeof (((1UL) << 12) - offset) *' (aka 'unsigned long *') and 'typeof (size) *' (aka 'unsigned int *'))

From: kernel test robot
Date: Fri Aug 27 2021 - 04:20:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-folio-regions
head: 2f3fe780e9a44691136170536363c701b527d0e8
commit: bbfa10bc8233de4c54031fd2009d866b3f6195c6 [18/36] netfs: Keep lists of pending, active, dirty and flushed regions
config: arm-randconfig-r015-20210827 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=bbfa10bc8233de4c54031fd2009d866b3f6195c6
git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
git fetch --no-tags dhowells-fs netfs-folio-regions
git checkout bbfa10bc8233de4c54031fd2009d866b3f6195c6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

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

All warnings (new ones prefixed by >>):

>> fs/netfs/write_helper.c:25:26: warning: comparison of distinct pointer types ('typeof (((1UL) << 12) - offset) *' (aka 'unsigned long *') and 'typeof (size) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
unsigned int psize = min(PAGE_SIZE - offset, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
1 warning generated.


vim +25 fs/netfs/write_helper.c

15
16 static size_t copy_folio_from_iter_atomic(struct folio *folio,
17 unsigned int offset, size_t size,
18 struct iov_iter *i)
19 {
20 size_t copied = 0, n;
21
22 do {
23 unsigned int index = offset / PAGE_SIZE;
24 unsigned int poffset = offset % PAGE_SIZE;
> 25 unsigned int psize = min(PAGE_SIZE - offset, size);
26
27 n = copy_page_from_iter_atomic(folio_file_page(folio, index),
28 poffset, psize, i);
29 copied += n;
30 if (n < psize)
31 break;
32 size -= n;
33 } while (size);
34 return copied;
35 }
36

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip