public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [ceph-client:testing 7/9] lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *'))
@ 2022-06-11 15:10 kernel test robot
  2022-06-12  2:26 ` Xiubo Li
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2022-06-11 15:10 UTC (permalink / raw)
  To: David Howells; +Cc: llvm, kbuild-all, ceph-devel, Xiubo Li, Jeff Layton

tree:   https://github.com/ceph/ceph-client.git testing
head:   7b864d005b1f7f6a144420e180891b6401078407
commit: 3adeefbfca0fd57cc943b7ec0330385f48041f0c [7/9] [DO NOT MERGE] iov_iter: Fix iter_xarray_get_pages{,_alloc}()
config: riscv-randconfig-r034-20220611 (https://download.01.org/0day-ci/archive/20220611/202206112305.4DdsErK8-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project ff4abe755279a3a47cc416ef80dbc900d9a98a19)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv-linux-gnu
        # https://github.com/ceph/ceph-client/commit/3adeefbfca0fd57cc943b7ec0330385f48041f0c
        git remote add ceph-client https://github.com/ceph/ceph-client.git
        git fetch --no-tags ceph-client testing
        git checkout 3adeefbfca0fd57cc943b7ec0330385f48041f0c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
           return min(nr * PAGE_SIZE - offset, maxsize);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   lib/iov_iter.c:1628:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
           return min(nr * PAGE_SIZE - offset, maxsize);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   2 warnings generated.


vim +1464 lib/iov_iter.c

  1430	
  1431	static ssize_t iter_xarray_get_pages(struct iov_iter *i,
  1432					     struct page **pages, size_t maxsize,
  1433					     unsigned maxpages, size_t *_start_offset)
  1434	{
  1435		unsigned nr, offset;
  1436		pgoff_t index, count;
  1437		size_t size = maxsize;
  1438		loff_t pos;
  1439	
  1440		if (!size || !maxpages)
  1441			return 0;
  1442	
  1443		pos = i->xarray_start + i->iov_offset;
  1444		index = pos >> PAGE_SHIFT;
  1445		offset = pos & ~PAGE_MASK;
  1446		*_start_offset = offset;
  1447	
  1448		count = 1;
  1449		if (size > PAGE_SIZE - offset) {
  1450			size -= PAGE_SIZE - offset;
  1451			count += size >> PAGE_SHIFT;
  1452			size &= ~PAGE_MASK;
  1453			if (size)
  1454				count++;
  1455		}
  1456	
  1457		if (count > maxpages)
  1458			count = maxpages;
  1459	
  1460		nr = iter_xarray_populate_pages(pages, i->xarray, index, count);
  1461		if (nr == 0)
  1462			return 0;
  1463	
> 1464		return min(nr * PAGE_SIZE - offset, maxsize);
  1465	}
  1466	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ceph-client:testing 7/9] lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *'))
  2022-06-11 15:10 [ceph-client:testing 7/9] lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *')) kernel test robot
@ 2022-06-12  2:26 ` Xiubo Li
  2022-06-13  7:52   ` David Howells
  0 siblings, 1 reply; 4+ messages in thread
From: Xiubo Li @ 2022-06-12  2:26 UTC (permalink / raw)
  To: kernel test robot, David Howells
  Cc: llvm, kbuild-all, ceph-devel, Jeff Layton

Thanks for the warning report.

These was introduced by one DO NOT MEGE patch, which should go into 
mainline via David Howells's tree IMO.

-- Xiubo


On 6/11/22 11:10 PM, kernel test robot wrote:
> tree:   https://github.com/ceph/ceph-client.git testing
> head:   7b864d005b1f7f6a144420e180891b6401078407
> commit: 3adeefbfca0fd57cc943b7ec0330385f48041f0c [7/9] [DO NOT MERGE] iov_iter: Fix iter_xarray_get_pages{,_alloc}()
> config: riscv-randconfig-r034-20220611 (https://download.01.org/0day-ci/archive/20220611/202206112305.4DdsErK8-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project ff4abe755279a3a47cc416ef80dbc900d9a98a19)
> 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 riscv cross compiling tool for clang build
>          # apt-get install binutils-riscv-linux-gnu
>          # https://github.com/ceph/ceph-client/commit/3adeefbfca0fd57cc943b7ec0330385f48041f0c
>          git remote add ceph-client https://github.com/ceph/ceph-client.git
>          git fetch --no-tags ceph-client testing
>          git checkout 3adeefbfca0fd57cc943b7ec0330385f48041f0c
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
>>> lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
>             return min(nr * PAGE_SIZE - offset, maxsize);
>                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     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)))
>                        ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
>     lib/iov_iter.c:1628:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
>             return min(nr * PAGE_SIZE - offset, maxsize);
>                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     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)))
>                        ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
>     2 warnings generated.
>
>
> vim +1464 lib/iov_iter.c
>
>    1430	
>    1431	static ssize_t iter_xarray_get_pages(struct iov_iter *i,
>    1432					     struct page **pages, size_t maxsize,
>    1433					     unsigned maxpages, size_t *_start_offset)
>    1434	{
>    1435		unsigned nr, offset;
>    1436		pgoff_t index, count;
>    1437		size_t size = maxsize;
>    1438		loff_t pos;
>    1439	
>    1440		if (!size || !maxpages)
>    1441			return 0;
>    1442	
>    1443		pos = i->xarray_start + i->iov_offset;
>    1444		index = pos >> PAGE_SHIFT;
>    1445		offset = pos & ~PAGE_MASK;
>    1446		*_start_offset = offset;
>    1447	
>    1448		count = 1;
>    1449		if (size > PAGE_SIZE - offset) {
>    1450			size -= PAGE_SIZE - offset;
>    1451			count += size >> PAGE_SHIFT;
>    1452			size &= ~PAGE_MASK;
>    1453			if (size)
>    1454				count++;
>    1455		}
>    1456	
>    1457		if (count > maxpages)
>    1458			count = maxpages;
>    1459	
>    1460		nr = iter_xarray_populate_pages(pages, i->xarray, index, count);
>    1461		if (nr == 0)
>    1462			return 0;
>    1463	
>> 1464		return min(nr * PAGE_SIZE - offset, maxsize);
>    1465	}
>    1466	
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ceph-client:testing 7/9] lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *'))
  2022-06-12  2:26 ` Xiubo Li
@ 2022-06-13  7:52   ` David Howells
  2022-06-13 10:18     ` Xiubo Li
  0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2022-06-13  7:52 UTC (permalink / raw)
  To: Xiubo Li
  Cc: dhowells, kernel test robot, llvm, kbuild-all, ceph-devel,
	Jeff Layton

Xiubo Li <xiubli@redhat.com> wrote:

> Thanks for the warning report.
> 
> These was introduced by one DO NOT MEGE patch, which should go into mainline
> via David Howells's tree IMO.

That appears to have been fixed upstream.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1c27f1fc1549f0e470429f5497a76ad28a37f21a

David


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ceph-client:testing 7/9] lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *'))
  2022-06-13  7:52   ` David Howells
@ 2022-06-13 10:18     ` Xiubo Li
  0 siblings, 0 replies; 4+ messages in thread
From: Xiubo Li @ 2022-06-13 10:18 UTC (permalink / raw)
  To: David Howells
  Cc: kernel test robot, llvm, kbuild-all, ceph-devel, Jeff Layton


On 6/13/22 3:52 PM, David Howells wrote:
> Xiubo Li <xiubli@redhat.com> wrote:
>
>> Thanks for the warning report.
>>
>> These was introduced by one DO NOT MEGE patch, which should go into mainline
>> via David Howells's tree IMO.
> That appears to have been fixed upstream.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1c27f1fc1549f0e470429f5497a76ad28a37f21a

Yeah, this will fix it.

Thanks David.

-- Xiubo


>
> David
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-13 10:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-11 15:10 [ceph-client:testing 7/9] lib/iov_iter.c:1464:9: warning: comparison of distinct pointer types ('typeof (nr * ((1UL) << (12)) - offset) *' (aka 'unsigned long *') and 'typeof (maxsize) *' (aka 'unsigned int *')) kernel test robot
2022-06-12  2:26 ` Xiubo Li
2022-06-13  7:52   ` David Howells
2022-06-13 10:18     ` Xiubo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox