Re: [PATCH v10 2/9] overflow: Move and add few utility macros into overflow

From: kernel test robot
Date: Sat Sep 17 2022 - 19:32:23 EST


Hi Gwan-gyeong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master v6.0-rc5]
[cannot apply to drm-intel/for-linux-next kees/for-next/hardening next-20220916]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Gwan-gyeong-Mun/Fixes-integer-overflow-or-integer-truncation-issues-in-page-lookups-ttm-place-configuration-and-scatterlist-creation/20220909-190301
base: git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220918/202209180742.kE2Xbxqz-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/8d39d691758034d1082773e43b9cb4738b1f4387
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Gwan-gyeong-Mun/Fixes-integer-overflow-or-integer-truncation-issues-in-page-lookups-ttm-place-configuration-and-scatterlist-creation/20220909-190301
git checkout 8d39d691758034d1082773e43b9cb4738b1f4387
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/i915/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/i915/i915_user_extensions.c:56:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct i915_user_extension [noderef] __user *ext @@ got void *[noderef] __user @@
drivers/gpu/drm/i915/i915_user_extensions.c:56:21: sparse: expected struct i915_user_extension [noderef] __user *ext
drivers/gpu/drm/i915/i915_user_extensions.c:56:21: sparse: got void *[noderef] __user

vim +56 drivers/gpu/drm/i915/i915_user_extensions.c

15
16 int i915_user_extensions(struct i915_user_extension __user *ext,
17 const i915_user_extension_fn *tbl,
18 unsigned int count,
19 void *data)
20 {
21 unsigned int stackdepth = 512;
22
23 while (ext) {
24 int i, err;
25 u32 name;
26 u64 next;
27
28 if (!stackdepth--) /* recursion vs useful flexibility */
29 return -E2BIG;
30
31 err = check_user_mbz(&ext->flags);
32 if (err)
33 return err;
34
35 for (i = 0; i < ARRAY_SIZE(ext->rsvd); i++) {
36 err = check_user_mbz(&ext->rsvd[i]);
37 if (err)
38 return err;
39 }
40
41 if (get_user(name, &ext->name))
42 return -EFAULT;
43
44 err = -EINVAL;
45 if (name < count) {
46 name = array_index_nospec(name, count);
47 if (tbl[name])
48 err = tbl[name](ext, data);
49 }
50 if (err)
51 return err;
52
53 if (get_user(next, &ext->next_extension))
54 return -EFAULT;
55
> 56 if (check_assign_user_ptr(next, ext))

--
0-DAY CI Kernel Test Service
https://01.org/lkp