[intel-tdx:guest 69/127] drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: error: shift count >= width of type
From: kernel test robot
Date: Tue Sep 28 2021 - 07:55:58 EST
tree: https://github.com/intel/tdx.git guest
head: 10b6ec254ee65ec602a7c3efde66ac0ca545b4bc
commit: b0040b6252b9f83c00f70d3b975238cb47381270 [69/127] x86/tdx: Add device filter support for x86 TDX guest platform
config: x86_64-randconfig-a006-20210928 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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/intel/tdx/commit/b0040b6252b9f83c00f70d3b975238cb47381270
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx guest
git checkout b0040b6252b9f83c00f70d3b975238cb47381270
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
In file included from <built-in>:4:
In file included from drivers/gpu/drm/i915/display/intel_cdclk.h:11:
In file included from drivers/gpu/drm/i915/i915_drv.h:36:
In file included from arch/x86/include/asm/hypervisor.h:37:
In file included from arch/x86/include/asm/kvm_para.h:7:
arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
return dev->authorized;
~~~^
include/linux/bitmap.h:13:8: note: forward declaration of 'struct device'
struct device;
^
In file included from <built-in>:4:
In file included from drivers/gpu/drm/i915/display/intel_cdclk.h:11:
In file included from drivers/gpu/drm/i915/i915_drv.h:84:
In file included from drivers/gpu/drm/i915/gt/intel_engine.h:17:
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:21:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43: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))
^ ~~~~~~~~~~~~~~~~
2 errors generated.
--
In file included from drivers/gpu/drm/i915/gem/i915_gem_internal.c:7:
In file included from include/linux/scatterlist.h:9:
In file included from arch/x86/include/asm/io.h:45:
arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
return dev->authorized;
~~~^
include/linux/bitmap.h:13:8: note: forward declaration of 'struct device'
struct device;
^
In file included from drivers/gpu/drm/i915/gem/i915_gem_internal.c:11:
In file included from drivers/gpu/drm/i915/i915_drv.h:84:
In file included from drivers/gpu/drm/i915/gt/intel_engine.h:17:
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:21:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43: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))
^ ~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/gem/i915_gem_internal.c:172: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))
^ ~~~~~~~~~~~~~~~~
3 errors generated.
--
In file included from drivers/gpu/drm/i915/i915_query.c:9:
In file included from drivers/gpu/drm/i915/i915_drv.h:36:
In file included from arch/x86/include/asm/hypervisor.h:37:
In file included from arch/x86/include/asm/kvm_para.h:7:
arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
return dev->authorized;
~~~^
include/linux/bitmap.h:13:8: note: forward declaration of 'struct device'
struct device;
^
In file included from drivers/gpu/drm/i915/i915_query.c:9:
In file included from drivers/gpu/drm/i915/i915_drv.h:84:
In file included from drivers/gpu/drm/i915/gt/intel_engine.h:17:
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:21:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43: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))
^ ~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_query.c:513:7: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
if (overflows_type(item.query_id - 1, unsigned long))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:125:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
3 errors generated.
--
In file included from drivers/gpu/drm/i915/display/intel_dsi_vbt.c:29:
In file included from include/linux/mfd/intel_soc_pmic.h:14:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/x86/include/asm/io.h:45:
arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
return dev->authorized;
~~~^
include/linux/gpio/consumer.h:10:8: note: forward declaration of 'struct device'
struct device;
^
In file included from drivers/gpu/drm/i915/display/intel_dsi_vbt.c:42:
In file included from drivers/gpu/drm/i915/i915_drv.h:84:
In file included from drivers/gpu/drm/i915/gt/intel_engine.h:17:
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:21:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43: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))
^ ~~~~~~~~~~~~~~~~
2 errors generated.
vim +43 drivers/gpu/drm/i915/gem/i915_gem_object.h
b6e913e19c54ed Thomas Hellström 2021-06-29 22
ae2fb480f32f65 Matthew Auld 2021-01-22 23 /*
ae2fb480f32f65 Matthew Auld 2021-01-22 24 * XXX: There is a prevalence of the assumption that we fit the
ae2fb480f32f65 Matthew Auld 2021-01-22 25 * object's page count inside a 32bit _signed_ variable. Let's document
ae2fb480f32f65 Matthew Auld 2021-01-22 26 * this and catch if we ever need to fix it. In the meantime, if you do
ae2fb480f32f65 Matthew Auld 2021-01-22 27 * spot such a local variable, please consider fixing!
ae2fb480f32f65 Matthew Auld 2021-01-22 28 *
ae2fb480f32f65 Matthew Auld 2021-01-22 29 * Aside from our own locals (for which we have no excuse!):
ae2fb480f32f65 Matthew Auld 2021-01-22 30 * - sg_table embeds unsigned int for num_pages
ae2fb480f32f65 Matthew Auld 2021-01-22 31 * - get_user_pages*() mixed ints with longs
ae2fb480f32f65 Matthew Auld 2021-01-22 32 */
ae2fb480f32f65 Matthew Auld 2021-01-22 33 #define GEM_CHECK_SIZE_OVERFLOW(sz) \
ae2fb480f32f65 Matthew Auld 2021-01-22 34 GEM_WARN_ON((sz) >> PAGE_SHIFT > INT_MAX)
ae2fb480f32f65 Matthew Auld 2021-01-22 35
ae2fb480f32f65 Matthew Auld 2021-01-22 36 static inline bool i915_gem_object_size_2big(u64 size)
ae2fb480f32f65 Matthew Auld 2021-01-22 37 {
ae2fb480f32f65 Matthew Auld 2021-01-22 38 struct drm_i915_gem_object *obj;
ae2fb480f32f65 Matthew Auld 2021-01-22 39
ae2fb480f32f65 Matthew Auld 2021-01-22 40 if (GEM_CHECK_SIZE_OVERFLOW(size))
ae2fb480f32f65 Matthew Auld 2021-01-22 41 return true;
ae2fb480f32f65 Matthew Auld 2021-01-22 42
ae2fb480f32f65 Matthew Auld 2021-01-22 @43 if (overflows_type(size, obj->base.size))
ae2fb480f32f65 Matthew Auld 2021-01-22 44 return true;
ae2fb480f32f65 Matthew Auld 2021-01-22 45
ae2fb480f32f65 Matthew Auld 2021-01-22 46 return false;
ae2fb480f32f65 Matthew Auld 2021-01-22 47 }
ae2fb480f32f65 Matthew Auld 2021-01-22 48
:::::: The code at line 43 was first introduced by commit
:::::: ae2fb480f32f657d896d78b6214c2efebfa61993 drm/i915/gem: consolidate 2big error checking for object sizes
:::::: TO: Matthew Auld <matthew.auld@xxxxxxxxx>
:::::: CC: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip