drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: error: shift count >= width of type

From: kernel test robot
Date: Fri Nov 05 2021 - 00:33:37 EST


tree: https://github.com/0day-ci/linux/commits/UPDATE-20211105-015602/Kieran-Bingham/arm64-dts-renesas-r8a779a0-falcon-cpu-Add-SW46-switch-support/20211025-210557
head: ee2f237110e65ac76c12b958ba928a3f18940b8a
commit: ee2f237110e65ac76c12b958ba928a3f18940b8a Input: add 'safe' user switch codes
date: 11 hours ago
config: x86_64-randconfig-a001-20211105 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 847a6807332b13f43704327c2d30103ec0347c77)
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/0day-ci/linux/commit/ee2f237110e65ac76c12b958ba928a3f18940b8a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20211105-015602/Kieran-Bingham/arm64-dts-renesas-r8a779a0-falcon-cpu-Add-SW46-switch-support/20211025-210557
git checkout ee2f237110e65ac76c12b958ba928a3f18940b8a
# 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_dsi.h:30:
In file included from drivers/gpu/drm/i915/display/intel_display_types.h:45:
In file included from include/media/cec-notifier.h:13:
In file included from include/media/cec.h:19:
In file included from include/media/rc-core.h:16:
In file included from include/media/rc-map.h:11:
include/linux/input.h:256:2: error: "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
#error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
^
In file included from <built-in>:4:
In file included from drivers/gpu/drm/i915/display/intel_dsi.h:30:
In file included from drivers/gpu/drm/i915/display/intel_display_types.h:47:
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/display/intel_fb.c:9:
In file included from drivers/gpu/drm/i915/display/intel_display_types.h:45:
In file included from include/media/cec-notifier.h:13:
In file included from include/media/cec.h:19:
In file included from include/media/rc-core.h:16:
In file included from include/media/rc-map.h:11:
include/linux/input.h:256:2: error: "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
#error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
^
In file included from drivers/gpu/drm/i915/display/intel_fb.c:9:
In file included from drivers/gpu/drm/i915/display/intel_display_types.h:47:
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/display/intel_fb.c:660:2: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
assign_chk_ovf(i915, remap_info->offset, obj_offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_fb.c:642:28: note: expanded from macro 'assign_chk_ovf'
drm_WARN_ON(&(i915)->drm, overflows_type(val, var)); \
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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/drm/drm_print.h:563:19: note: expanded from macro 'drm_WARN_ON'
drm_WARN((drm), (x), "%s", \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/drm/drm_print.h:553:7: note: expanded from macro 'drm_WARN'
WARN(condition, "%s %s: " format, \
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:130:25: note: expanded from macro 'WARN'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
3 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

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip