[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210020205.dBxDbuYq-lkp@intel.com>
Date: Sun, 2 Oct 2022 02:54:59 +0800
From: kernel test robot <lkp@...el.com>
To: Kees Cook <keescook@...omium.org>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
Gwan-gyeong Mun <gwan-gyeong.mun@...el.com>
Subject: [kees:devel/hardening 52/69]
drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to
binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and
'unsigned long')
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git devel/hardening
head: 4b677c85590798c3141758109cc5be7ba068a3ff
commit: b8ff84101ad3b4f8f48a8db4604b72f08c222be2 [52/69] overflow: Introduce overflows_type() and castable_to_type()
config: x86_64-randconfig-a005
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/kees/linux.git/commit/?id=b8ff84101ad3b4f8f48a8db4604b72f08c222be2
git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
git fetch --no-tags kees devel/hardening
git checkout b8ff84101ad3b4f8f48a8db4604b72f08c222be2
# 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=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:132:9: note: expanded from macro '__overflows_type_constexpr'
(x) > type_max(typeof(T)) ? 1 : 0 \
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:34:27: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:132:9: note: expanded from macro '__overflows_type_constexpr'
(x) > type_max(typeof(T)) ? 1 : 0 \
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:34:53: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_user_extensions.c:54:7: warning: ordered comparison between pointer and integer ('u64' (aka 'unsigned long long') and 'typeof (ext)' (aka 'struct i915_user_extension *'))
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:132:7: note: expanded from macro '__overflows_type_constexpr'
(x) > type_max(typeof(T)) ? 1 : 0 \
~~~ ^ ~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:134:20: note: expanded from macro '__overflows_type_constexpr'
(x) < 0 || (x) > type_max(typeof(T)) ? 1 : 0 \
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:34:27: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:134:20: note: expanded from macro '__overflows_type_constexpr'
(x) < 0 || (x) > type_max(typeof(T)) ? 1 : 0 \
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:34:53: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_user_extensions.c:54:7: warning: ordered comparison between pointer and integer ('u64' (aka 'unsigned long long') and 'typeof (ext)' (aka 'struct i915_user_extension *'))
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:134:18: note: expanded from macro '__overflows_type_constexpr'
(x) < 0 || (x) > type_max(typeof(T)) ? 1 : 0 \
~~~ ^ ~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:135:11: note: expanded from macro '__overflows_type_constexpr'
: (x) < type_min(typeof(T)) || \
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:35:30: note: expanded from macro 'type_min'
#define type_min(T) ((T)((T)-type_max(T)-(T)1))
^~~~~~~~~~~
include/linux/overflow.h:34:27: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:135:11: note: expanded from macro '__overflows_type_constexpr'
: (x) < type_min(typeof(T)) || \
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:35:30: note: expanded from macro 'type_min'
#define type_min(T) ((T)((T)-type_max(T)-(T)1))
^~~~~~~~~~~
include/linux/overflow.h:34:53: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid argument type 'typeof (ext)' (aka 'struct i915_user_extension *') to unary expression
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:135:11: note: expanded from macro '__overflows_type_constexpr'
: (x) < type_min(typeof(T)) || \
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:35:29: note: expanded from macro 'type_min'
#define type_min(T) ((T)((T)-type_max(T)-(T)1))
^~~~~~~~~~~~
drivers/gpu/drm/i915/i915_user_extensions.c:54:7: warning: ordered comparison between pointer and integer ('u64' (aka 'unsigned long long') and 'typeof (ext)' (aka 'struct i915_user_extension *'))
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:135:9: note: expanded from macro '__overflows_type_constexpr'
: (x) < type_min(typeof(T)) || \
~~~ ^ ~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:136:11: note: expanded from macro '__overflows_type_constexpr'
(x) > type_max(typeof(T)) ? 1 : 0)
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:34:27: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: invalid operands to binary expression ('typeof (ext)' (aka 'struct i915_user_extension *') and 'unsigned long')
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:136:11: note: expanded from macro '__overflows_type_constexpr'
(x) > type_max(typeof(T)) ? 1 : 0)
^~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:34:53: note: expanded from macro 'type_max'
#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:33:40: note: expanded from macro '__type_half_max'
#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_user_extensions.c:54:7: warning: ordered comparison between pointer and integer ('u64' (aka 'unsigned long long') and 'typeof (ext)' (aka 'struct i915_user_extension *'))
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:159:10: note: expanded from macro 'overflows_type'
__overflows_type_constexpr(n, T), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:136:9: note: expanded from macro '__overflows_type_constexpr'
(x) > type_max(typeof(T)) ? 1 : 0)
~~~ ^ ~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_user_extensions.c:54:7: error: operand argument to overflow builtin must be an integer ('typeof (ext)' (aka 'struct i915_user_extension *') invalid)
overflows_type(next, ext))
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:160:10: note: expanded from macro 'overflows_type'
__overflows_type(n, T))
^~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:140:26: note: expanded from macro '__overflows_type'
check_add_overflow((x), v, &v); \
^
include/linux/overflow.h:67:50: note: expanded from macro 'check_add_overflow'
__must_check_overflow(__builtin_add_overflow(a, b, d))
^
4 warnings and 10 errors generated.
vim +54 drivers/gpu/drm/i915/i915_user_extensions.c
9d1305ef80b95d Chris Wilson 2019-03-22 15
9d1305ef80b95d Chris Wilson 2019-03-22 16 int i915_user_extensions(struct i915_user_extension __user *ext,
9d1305ef80b95d Chris Wilson 2019-03-22 17 const i915_user_extension_fn *tbl,
9d1305ef80b95d Chris Wilson 2019-03-22 18 unsigned int count,
9d1305ef80b95d Chris Wilson 2019-03-22 19 void *data)
9d1305ef80b95d Chris Wilson 2019-03-22 20 {
9d1305ef80b95d Chris Wilson 2019-03-22 21 unsigned int stackdepth = 512;
9d1305ef80b95d Chris Wilson 2019-03-22 22
9d1305ef80b95d Chris Wilson 2019-03-22 23 while (ext) {
9d1305ef80b95d Chris Wilson 2019-03-22 24 int i, err;
9d1305ef80b95d Chris Wilson 2019-03-22 25 u32 name;
9d1305ef80b95d Chris Wilson 2019-03-22 26 u64 next;
9d1305ef80b95d Chris Wilson 2019-03-22 27
9d1305ef80b95d Chris Wilson 2019-03-22 28 if (!stackdepth--) /* recursion vs useful flexibility */
9d1305ef80b95d Chris Wilson 2019-03-22 29 return -E2BIG;
9d1305ef80b95d Chris Wilson 2019-03-22 30
9d1305ef80b95d Chris Wilson 2019-03-22 31 err = check_user_mbz(&ext->flags);
9d1305ef80b95d Chris Wilson 2019-03-22 32 if (err)
9d1305ef80b95d Chris Wilson 2019-03-22 33 return err;
9d1305ef80b95d Chris Wilson 2019-03-22 34
9d1305ef80b95d Chris Wilson 2019-03-22 35 for (i = 0; i < ARRAY_SIZE(ext->rsvd); i++) {
9d1305ef80b95d Chris Wilson 2019-03-22 36 err = check_user_mbz(&ext->rsvd[i]);
9d1305ef80b95d Chris Wilson 2019-03-22 37 if (err)
9d1305ef80b95d Chris Wilson 2019-03-22 38 return err;
9d1305ef80b95d Chris Wilson 2019-03-22 39 }
9d1305ef80b95d Chris Wilson 2019-03-22 40
9d1305ef80b95d Chris Wilson 2019-03-22 41 if (get_user(name, &ext->name))
9d1305ef80b95d Chris Wilson 2019-03-22 42 return -EFAULT;
9d1305ef80b95d Chris Wilson 2019-03-22 43
9d1305ef80b95d Chris Wilson 2019-03-22 44 err = -EINVAL;
9d1305ef80b95d Chris Wilson 2019-03-22 45 if (name < count) {
9d1305ef80b95d Chris Wilson 2019-03-22 46 name = array_index_nospec(name, count);
9d1305ef80b95d Chris Wilson 2019-03-22 47 if (tbl[name])
9d1305ef80b95d Chris Wilson 2019-03-22 48 err = tbl[name](ext, data);
9d1305ef80b95d Chris Wilson 2019-03-22 49 }
9d1305ef80b95d Chris Wilson 2019-03-22 50 if (err)
9d1305ef80b95d Chris Wilson 2019-03-22 51 return err;
9d1305ef80b95d Chris Wilson 2019-03-22 52
9d1305ef80b95d Chris Wilson 2019-03-22 53 if (get_user(next, &ext->next_extension) ||
9d1305ef80b95d Chris Wilson 2019-03-22 @54 overflows_type(next, ext))
:::::: The code at line 54 was first introduced by commit
:::::: 9d1305ef80b95dde0337106ed8b826604e2155ad drm/i915: Introduce the i915_user_extension_method
:::::: TO: Chris Wilson <chris@...is-wilson.co.uk>
:::::: CC: Chris Wilson <chris@...is-wilson.co.uk>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (138663 bytes)
Powered by blists - more mailing lists