[hch-misc:dax-support-cleanups 6/7] drivers/gpu/drm/i915/gem/i915_gem_object.h:39:6: error: shift count >= width of type

From: kernel test robot
Date: Fri Jul 30 2021 - 07:27:45 EST


tree: git://git.infradead.org/users/hch/misc.git dax-support-cleanups
head: 109fe091fac0e3958ba459e292f22f6b60eb39f0
commit: 6ee1cc412315e2a92aa1b6b57e349f84ec4b1168 [6/7] dax: pass the dax_device to bdev_dax_supported
config: x86_64-randconfig-c001-20210730 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
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
git remote add hch-misc git://git.infradead.org/users/hch/misc.git
git fetch --no-tags hch-misc dax-support-cleanups
git checkout 6ee1cc412315e2a92aa1b6b57e349f84ec4b1168
# 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 <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:47:
In file included from drivers/gpu/drm/i915/i915_drv.h:49:
In file included from include/linux/shmem_fs.h:7:
In file included from include/linux/mempolicy.h:11:
include/linux/dax.h:153:39: error: unknown type name 'truct'; did you mean 'struct'?
static inline bool bdev_dax_supported(truct dax_device *dax_dev,
^~~~~
struct
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:17:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> 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))
^ ~~~~~~~~~~~~~~~~
2 errors generated.
--
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:49:
In file included from include/linux/shmem_fs.h:7:
In file included from include/linux/mempolicy.h:11:
include/linux/dax.h:153:39: error: unknown type name 'truct'; did you mean 'struct'?
static inline bool bdev_dax_supported(truct dax_device *dax_dev,
^~~~~
struct
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:17:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> 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))
^ ~~~~~~~~~~~~~~~~
>> 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_gem.c:32:
In file included from include/linux/shmem_fs.h:7:
In file included from include/linux/mempolicy.h:11:
include/linux/dax.h:153:39: error: unknown type name 'truct'; did you mean 'struct'?
static inline bool bdev_dax_supported(truct dax_device *dax_dev,
^~~~~
struct
In file included from drivers/gpu/drm/i915/i915_gem.c:38:
>> include/linux/mman.h:158:9: error: division by zero is undefined [-Werror,-Wdivision-by-zero]
_calc_vm_trans(flags, MAP_SYNC, VM_SYNC ) |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/mman.h:135:21: note: expanded from macro '_calc_vm_trans'
: ((x) & (bit1)) / ((bit1) / (bit2))))
^ ~~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/i915/i915_gem.c:44:
In file included from drivers/gpu/drm/i915/gem/i915_gem_context.h:12:
In file included from drivers/gpu/drm/i915/gt/intel_context.h:14:
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:17:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> 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))
^ ~~~~~~~~~~~~~~~~
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:49:
In file included from include/linux/shmem_fs.h:7:
In file included from include/linux/mempolicy.h:11:
include/linux/dax.h:153:39: error: unknown type name 'truct'; did you mean 'struct'?
static inline bool bdev_dax_supported(truct dax_device *dax_dev,
^~~~~
struct
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:17:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> 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))
^ ~~~~~~~~~~~~~~~~
>> 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_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:49:
In file included from include/linux/shmem_fs.h:7:
In file included from include/linux/mempolicy.h:11:
include/linux/dax.h:153:39: error: unknown type name 'truct'; did you mean 'struct'?
static inline bool bdev_dax_supported(truct dax_device *dax_dev,
^~~~~
struct
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:17:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> 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))
^ ~~~~~~~~~~~~~~~~
>> 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 +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 <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