All of lore.kernel.org
 help / color / mirror / Atom feed
* [jgunthorpe:iommufd 7/13] include/linux/overflow.h:66:22: warning: comparison of distinct pointer types lacks a cast
@ 2022-04-13 12:10 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-04-13 12:10 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: kbuild-all, linux-kernel

tree:   https://github.com/jgunthorpe/linux iommufd
head:   fc388f906088fe5f5f2db6a36931e00124f52042
commit: 1af524ce30ddf820ec974c8635d3299caefc72ed [7/13] iommufd: Data structure to provide IOVA to PFN mapping
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220413/202204132034.dp2f42wp-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.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://github.com/jgunthorpe/linux/commit/1af524ce30ddf820ec974c8635d3299caefc72ed
        git remote add jgunthorpe https://github.com/jgunthorpe/linux
        git fetch --no-tags jgunthorpe iommufd
        git checkout 1af524ce30ddf820ec974c8635d3299caefc72ed
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/iommu/iommufd/

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

   In file included from arch/arc/include/asm/bug.h:30,
                    from include/linux/bug.h:5,
                    from include/linux/cpumask.h:14,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from drivers/iommu/iommufd/io_pagetable.c:11:
   drivers/iommu/iommufd/io_pagetable.c: In function 'iopt_unaccess_pages':
>> include/linux/overflow.h:66:22: warning: comparison of distinct pointer types lacks a cast
      66 |         (void) (&__a == &__b);                  \
         |                      ^~
   include/asm-generic/bug.h:121:32: note: in definition of macro 'WARN_ON'
     121 |         int __ret_warn_on = !!(condition);                              \
         |                                ^~~~~~~~~
   drivers/iommu/iommufd/io_pagetable.c:486:21: note: in expansion of macro 'check_add_overflow'
     486 |             WARN_ON(check_add_overflow(iova, length - 1, &last_iova)))
         |                     ^~~~~~~~~~~~~~~~~~


vim +66 include/linux/overflow.h

9b80e4c4ddaca35 Kees Cook        2020-08-12  53  
f0907827a8a9152 Rasmus Villemoes 2018-05-08  54  /*
f0907827a8a9152 Rasmus Villemoes 2018-05-08  55   * For simplicity and code hygiene, the fallback code below insists on
f0907827a8a9152 Rasmus Villemoes 2018-05-08  56   * a, b and *d having the same type (similar to the min() and max()
f0907827a8a9152 Rasmus Villemoes 2018-05-08  57   * macros), whereas gcc's type-generic overflow checkers accept
f0907827a8a9152 Rasmus Villemoes 2018-05-08  58   * different types. Hence we don't just make check_add_overflow an
f0907827a8a9152 Rasmus Villemoes 2018-05-08  59   * alias for __builtin_add_overflow, but add type checks similar to
f0907827a8a9152 Rasmus Villemoes 2018-05-08  60   * below.
f0907827a8a9152 Rasmus Villemoes 2018-05-08  61   */
9b80e4c4ddaca35 Kees Cook        2020-08-12  62  #define check_add_overflow(a, b, d) __must_check_overflow(({	\
f0907827a8a9152 Rasmus Villemoes 2018-05-08  63  	typeof(a) __a = (a);			\
f0907827a8a9152 Rasmus Villemoes 2018-05-08  64  	typeof(b) __b = (b);			\
f0907827a8a9152 Rasmus Villemoes 2018-05-08  65  	typeof(d) __d = (d);			\
f0907827a8a9152 Rasmus Villemoes 2018-05-08 @66  	(void) (&__a == &__b);			\
f0907827a8a9152 Rasmus Villemoes 2018-05-08  67  	(void) (&__a == __d);			\
f0907827a8a9152 Rasmus Villemoes 2018-05-08  68  	__builtin_add_overflow(__a, __b, __d);	\
9b80e4c4ddaca35 Kees Cook        2020-08-12  69  }))
f0907827a8a9152 Rasmus Villemoes 2018-05-08  70  

:::::: The code at line 66 was first introduced by commit
:::::: f0907827a8a9152aedac2833ed1b674a7b2a44f2 compiler.h: enable builtin overflow checkers and add fallback code

:::::: TO: Rasmus Villemoes <linux@rasmusvillemoes.dk>
:::::: CC: Kees Cook <keescook@chromium.org>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-13 12:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-13 12:10 [jgunthorpe:iommufd 7/13] include/linux/overflow.h:66:22: warning: comparison of distinct pointer types lacks a cast kernel test robot

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.