[linux-next:master 5267/5396] drivers/gpu/drm/i915/gem/i915_gem_object.h:39:6: error: shift count >= width of type
From: kernel test robot <hidden>
Date: 2021-05-26 19:25:11
Also in:
oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: f6b46ef27317b3441138b902689bd89e4f82c6f4 commit: 55b24f9ce03ee4d6a06b874350c8297ac8135bf5 [5267/5396] mm/early_ioremap: add prototype for early_memremap_pgprot_adjust config: x86_64-randconfig-a012-20210526 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 99155e913e9bad5f7f8a247f8bb3a3ff3da74af1) 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 x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=55b24f9ce03ee4d6a06b874350c8297ac8135bf5 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 55b24f9ce03ee4d6a06b874350c8297ac8135bf5 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <redacted> All errors (new ones prefixed by >>): In file included from drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:7: In file included from include/linux/dma-buf.h:16: In file included from include/linux/dma-buf-map.h:9: In file included from include/linux/io.h:13: In file included from arch/x86/include/asm/io.h:44: In file included from ./arch/x86/include/generated/asm/early_ioremap.h:1: In file included from include/asm-generic/early_ioremap.h:6: arch/x86/include/asm/fixmap.h:103:48: error: use of undeclared identifier 'NR_CPUS' FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1, ^ In file included from drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:11: In file included from drivers/gpu/drm/i915/i915_drv.h:83: In file included from drivers/gpu/drm/i915/gt/intel_gt_types.h:18: In file included from drivers/gpu/drm/i915/gt/uc/intel_uc.h:9: In file included from drivers/gpu/drm/i915/gt/uc/intel_guc.h:17: In file included from drivers/gpu/drm/i915/i915_vma.h:34:
quoted
drivers/gpu/drm/i915/gem/i915_gem_object.h:39:6: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:125:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
In file included from drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:11:
In file included from drivers/gpu/drm/i915/i915_drv.h:83:
In file included from drivers/gpu/drm/i915/gt/intel_gt_types.h:18:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc.h:9:
In file included from drivers/gpu/drm/i915/gt/uc/intel_guc.h:17:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:quoted
drivers/gpu/drm/i915/gem/i915_gem_object.h:39:6: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:125:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
In file included from drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:11:
In file included from drivers/gpu/drm/i915/i915_drv.h:83:
In file included from drivers/gpu/drm/i915/gt/intel_gt_types.h:18:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc.h:9:
In file included from drivers/gpu/drm/i915/gt/uc/intel_guc.h:17:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:quoted
drivers/gpu/drm/i915/gem/i915_gem_object.h:39:6: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:125:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
~~~~~~~~~~~~~~~~~^~~~~
include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
(cond) ? \
^~~~
4 errors generated.
vim +39 drivers/gpu/drm/i915/gem/i915_gem_object.h
f0e4a06397526d Chris Wilson 2019-05-28 18
ae2fb480f32f65 Matthew Auld 2021-01-22 19 /*
ae2fb480f32f65 Matthew Auld 2021-01-22 20 * XXX: There is a prevalence of the assumption that we fit the
ae2fb480f32f65 Matthew Auld 2021-01-22 21 * object's page count inside a 32bit _signed_ variable. Let's document
ae2fb480f32f65 Matthew Auld 2021-01-22 22 * this and catch if we ever need to fix it. In the meantime, if you do
ae2fb480f32f65 Matthew Auld 2021-01-22 23 * spot such a local variable, please consider fixing!
ae2fb480f32f65 Matthew Auld 2021-01-22 24 *
ae2fb480f32f65 Matthew Auld 2021-01-22 25 * Aside from our own locals (for which we have no excuse!):
ae2fb480f32f65 Matthew Auld 2021-01-22 26 * - sg_table embeds unsigned int for num_pages
ae2fb480f32f65 Matthew Auld 2021-01-22 27 * - get_user_pages*() mixed ints with longs
ae2fb480f32f65 Matthew Auld 2021-01-22 28 */
ae2fb480f32f65 Matthew Auld 2021-01-22 29 #define GEM_CHECK_SIZE_OVERFLOW(sz) \
ae2fb480f32f65 Matthew Auld 2021-01-22 30 GEM_WARN_ON((sz) >> PAGE_SHIFT > INT_MAX)
ae2fb480f32f65 Matthew Auld 2021-01-22 31
ae2fb480f32f65 Matthew Auld 2021-01-22 32 static inline bool i915_gem_object_size_2big(u64 size)
ae2fb480f32f65 Matthew Auld 2021-01-22 33 {
ae2fb480f32f65 Matthew Auld 2021-01-22 34 struct drm_i915_gem_object *obj;
ae2fb480f32f65 Matthew Auld 2021-01-22 35
ae2fb480f32f65 Matthew Auld 2021-01-22 36 if (GEM_CHECK_SIZE_OVERFLOW(size))
ae2fb480f32f65 Matthew Auld 2021-01-22 37 return true;
ae2fb480f32f65 Matthew Auld 2021-01-22 38
ae2fb480f32f65 Matthew Auld 2021-01-22 @39 if (overflows_type(size, obj->base.size))
ae2fb480f32f65 Matthew Auld 2021-01-22 40 return true;
ae2fb480f32f65 Matthew Auld 2021-01-22 41
ae2fb480f32f65 Matthew Auld 2021-01-22 42 return false;
ae2fb480f32f65 Matthew Auld 2021-01-22 43 }
ae2fb480f32f65 Matthew Auld 2021-01-22 44
:::::: The code at line 39 was first introduced by commit
:::::: ae2fb480f32f657d896d78b6214c2efebfa61993 drm/i915/gem: consolidate 2big error checking for object sizes
:::::: TO: Matthew Auld [off-list ref]
:::::: CC: Daniel Vetter [off-list ref]
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Attachments
- .config.gz [application/gzip] 43566 bytes