From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [dhowells-fs:netfs-folio-regions 18/28] fs/netfs/write_prep.c:78:10: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof ((1UL << 18) - offset) *' (aka 'unsigned long *'))
Date: Fri, 20 Aug 2021 04:35:24 +0800 [thread overview]
Message-ID: <202108200415.7lAXba6f-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4123 bytes --]
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: hexagon-randconfig-r041-20210818 (attached as .config)
compiler: clang version 12.0.0
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=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=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/netfs/write_prep.c:78:10: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof ((1UL << 18) - offset) *' (aka 'unsigned long *')) [-Wcompare-distinct-pointer-types]
seg = min(len, PAGE_SIZE - offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 +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(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26608 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: David Howells <dhowells@redhat.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org
Subject: [dhowells-fs:netfs-folio-regions 18/28] fs/netfs/write_prep.c:78:10: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof ((1UL << 18) - offset) *' (aka 'unsigned long *'))
Date: Fri, 20 Aug 2021 04:35:24 +0800 [thread overview]
Message-ID: <202108200415.7lAXba6f-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4020 bytes --]
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: hexagon-randconfig-r041-20210818 (attached as .config)
compiler: clang version 12.0.0
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=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=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/netfs/write_prep.c:78:10: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof ((1UL << 18) - offset) *' (aka 'unsigned long *')) [-Wcompare-distinct-pointer-types]
seg = min(len, PAGE_SIZE - offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 +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@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26608 bytes --]
next reply other threads:[~2021-08-19 20:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-19 20:35 kernel test robot [this message]
2021-08-19 20:35 ` [dhowells-fs:netfs-folio-regions 18/28] fs/netfs/write_prep.c:78:10: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof ((1UL << 18) - offset) *' (aka 'unsigned long *')) kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202108200415.7lAXba6f-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.