[tglx-devel:msi 12/89] drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: warning: shift count >= width of type

From: kernel test robot
Date: Tue Nov 16 2021 - 16:04:29 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git msi
head: c176cd1c88abe6b527b9fc0bc58585b4f1858079
commit: af8fff0d2612f31d67146cf55e3d98870ab2f069 [12/89] PCI/MSI: Make arch_restore_msi_irqs() less horrible.
config: x86_64-buildonly-randconfig-r006-20211116 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
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/tglx/devel.git/commit/?id=af8fff0d2612f31d67146cf55e3d98870ab2f069
git remote add tglx-devel https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git
git fetch --no-tags tglx-devel msi
git checkout af8fff0d2612f31d67146cf55e3d98870ab2f069
# 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 warnings (new ones prefixed by >>):

In file included from drivers/gpu/drm/i915/i915_drv.c:50:
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:39:
arch/x86/include/asm/xen/hypervisor.h:78:2: error: #endif without #if
#endif /* _ASM_X86_XEN_HYPERVISOR_H */
^
In file included from drivers/gpu/drm/i915/i915_drv.c:50:
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:18:
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:19:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h:13:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
--
In file included from drivers/gpu/drm/i915/i915_config.c:6:
In file included from drivers/gpu/drm/i915/i915_drv.h:36:
In file included from arch/x86/include/asm/hypervisor.h:39:
arch/x86/include/asm/xen/hypervisor.h:64:51: warning: declaration of 'struct pci_dev' will not be visible outside of this function [-Wvisibility]
static inline bool xen_initdom_restore_msi(struct pci_dev *dev) { return true; }
^
arch/x86/include/asm/xen/hypervisor.h:78:2: error: #endif without #if
#endif /* _ASM_X86_XEN_HYPERVISOR_H */
^
In file included from drivers/gpu/drm/i915/i915_config.c:6:
In file included from drivers/gpu/drm/i915/i915_drv.h:84:
In file included from drivers/gpu/drm/i915/gt/intel_engine.h:18:
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:19:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h:13:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
2 warnings and 1 error generated.
--
In file included from drivers/gpu/drm/i915/intel_pm.c:38:
In file included from drivers/gpu/drm/i915/display/intel_de.h:9:
In file included from drivers/gpu/drm/i915/i915_drv.h:36:
In file included from arch/x86/include/asm/hypervisor.h:39:
arch/x86/include/asm/xen/hypervisor.h:78:2: error: #endif without #if
#endif /* _ASM_X86_XEN_HYPERVISOR_H */
^
In file included from drivers/gpu/drm/i915/intel_pm.c:38:
In file included from drivers/gpu/drm/i915/display/intel_de.h: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:18:
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:19:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h:13:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_pm.c:3065:12: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/intel_pm.c:3065:12: note: cast one or both operands to int to silence this warning
drivers/gpu/drm/i915/intel_pm.c:3065:12: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
||
drivers/gpu/drm/i915/intel_pm.c:3065:12: note: cast one or both operands to int to silence this warning
3 warnings and 1 error 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:36:
In file included from arch/x86/include/asm/hypervisor.h:39:
arch/x86/include/asm/xen/hypervisor.h:78:2: error: #endif without #if
#endif /* _ASM_X86_XEN_HYPERVISOR_H */
^
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:18:
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:19:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h:13:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126: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:174:6: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
2 warnings and 1 error 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:39:
arch/x86/include/asm/xen/hypervisor.h:64:51: warning: declaration of 'struct pci_dev' will not be visible outside of this function [-Wvisibility]
static inline bool xen_initdom_restore_msi(struct pci_dev *dev) { return true; }
^
arch/x86/include/asm/xen/hypervisor.h:78:2: error: #endif without #if
#endif /* _ASM_X86_XEN_HYPERVISOR_H */
^
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:18:
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:19:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h:13:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_query.c:512:7: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(item.query_id - 1, unsigned long))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
3 warnings and 1 error generated.
--
In file included from drivers/gpu/drm/i915/display/intel_fb.c:10:
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:36:
In file included from arch/x86/include/asm/hypervisor.h:39:
arch/x86/include/asm/xen/hypervisor.h:78:2: error: #endif without #if
#endif /* _ASM_X86_XEN_HYPERVISOR_H */
^
In file included from drivers/gpu/drm/i915/display/intel_fb.c:10:
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:18:
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:19:
In file included from drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h:13:
In file included from drivers/gpu/drm/i915/i915_vma.h:34:
>> drivers/gpu/drm/i915/gem/i915_gem_object.h:43:6: warning: shift count >= width of type [-Wshift-count-overflow]
if (overflows_type(size, obj->base.size))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^ ~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/display/intel_fb.c:863:2: warning: shift count >= width of type [-Wshift-count-overflow]
assign_chk_ovf(i915, remap_info->offset, obj_offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_fb.c:845:28: note: expanded from macro 'assign_chk_ovf'
drm_WARN_ON(&(i915)->drm, overflows_type(val, var)); \
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/i915_utils.h:126:32: note: expanded from macro 'overflows_type'
(sizeof(x) > sizeof(T) && (x) >> BITS_PER_TYPE(T))
^
include/drm/drm_print.h:593:19: note: expanded from macro 'drm_WARN_ON'
drm_WARN((drm), (x), "%s", \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/drm/drm_print.h:583: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); \
^~~~~~~~~
2 warnings and 1 error 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