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

From: kernel test robot
Date: Mon Aug 23 2021 - 19:15:42 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-folio-regions
head: bee78a1e3c9ae86d025b0b8f44c2553228fd9d2c
commit: 3ef8de77f6481b47212b87940b5f541339eb49fa [17/33] netfs: Keep lists of pending, active, dirty and flushed regions
config: hexagon-buildonly-randconfig-r001-20210823 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 79b55e5038324e61a3abf4e6a9a949c473edd858)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=3ef8de77f6481b47212b87940b5f541339eb49fa
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 3ef8de77f6481b47212b87940b5f541339eb49fa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon

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 << 18) - 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