[dhowells-fs:netfs-folio-regions 18/28] fs/netfs/write_prep.c:78:31: sparse: sparse: incompatible types in comparison expression (different type sizes):

From: kernel test robot
Date: Thu Aug 19 2021 - 17:14:43 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-folio-regions
head: 215a4ee495a95cc73256ed76f91cb78bcabd6b8e
commit: 0c1c1796fd33fded73a9a4305a9e43e8922746ee [18/28] netfs: Do encryption in write preparatory phase
config: nios2-randconfig-s031-20210818 (attached as .config)
compiler: nios2-linux-gcc (GCC) 11.2.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.3-348-gf0e6938b-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=0c1c1796fd33fded73a9a4305a9e43e8922746ee
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 0c1c1796fd33fded73a9a4305a9e43e8922746ee
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=nios2 SHELL=/bin/bash fs/netfs/

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/netfs/write_prep.c:78:31: sparse: sparse: incompatible types in comparison expression (different type sizes):
>> fs/netfs/write_prep.c:78:31: sparse: unsigned int *
>> fs/netfs/write_prep.c:78:31: sparse: unsigned long *

vim +78 fs/netfs/write_prep.c

46
47 /*
48 * Populate a scatterlist from folios in an xarray.
49 */
50 static int netfs_xarray_to_sglist(struct xarray *xa, loff_t pos, size_t len,
51 struct scatterlist *sg, unsigned int n_sg)
52 {
53 struct scatterlist *p = sg;
54 struct folio *folio = NULL;
55 size_t seg, offset, skip = 0;
56 loff_t start = pos;
57 pgoff_t index = start >> PAGE_SHIFT;
58 int j;
59
60 XA_STATE(xas, xa, index);
61
62 sg_init_table(sg, n_sg);
63
64 rcu_read_lock();
65
66 xas_for_each(&xas, folio, ULONG_MAX) {
67 kdebug("LOAD %lx %px", folio->index, folio);
68 if (xas_retry(&xas, folio))
69 continue;
70 if (WARN_ON(xa_is_value(folio)) || WARN_ON(folio_test_hugetlb(folio)))
71 break;
72 for (j = (folio_index(folio) < index) ? index - folio_index(folio) : 0;
73 j < folio_nr_pages(folio); j++
74 ) {
75 struct page *subpage = folio_file_page(folio, j);
76
77 offset = (pos + skip) & ~PAGE_MASK;
> 78 seg = min(len, PAGE_SIZE - offset);
79
80 kdebug("[%zx] %lx %zx @%zx", p - sg, subpage->index, seg, offset);
81 sg_set_page(p++, subpage, seg, offset);
82
83 len -= seg;
84 skip += seg;
85 if (len == 0)
86 break;
87 }
88 if (len == 0)
89 break;
90 }
91
92 rcu_read_unlock();
93 if (len > 0) {
94 WARN_ON(len > 0);
95 return -EIO;
96 }
97
98 sg_mark_end(p - 1);
99 kleave(" = %zd", p - sg);
100 return p - sg;
101 }
102

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

Attachment: .config.gz
Description: application/gzip