drivers/gpu/drm/xe/xe_sync.c:58:21-27: ERROR: application of sizeof to pointer
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 931a3b3bccc96e7708c82b30b2b5fa82dfd04890 commit: 0fde907da2d5fd4da68845e96c6842497159c858 [653/1162] drm/xe: Validate user fence during creation config: sh-randconfig-r051-20240729 (https://download.01.org/0day-ci/archive/20240730/[email protected]/config) compiler: sh4-linux-gcc (GCC) 14.1.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/xe/xe_sync.c:58:21-27: ERROR: application of sizeof to pointer
vim +58 drivers/gpu/drm/xe/xe_sync.c
51
52 static struct xe_user_fence *user_fence_create(struct xe_device *xe, u64 addr,
53 u64 value)
54 {
55 struct xe_user_fence *ufence;
56 u64 __user *ptr = u64_to_user_ptr(addr);
57
> 58 if (!access_ok(ptr, sizeof(ptr)))
59 return ERR_PTR(-EFAULT);
60
61 ufence = kmalloc(sizeof(*ufence), GFP_KERNEL);
62 if (!ufence)
63 return ERR_PTR(-ENOMEM);
64
65 ufence->xe = xe;
66 kref_init(&ufence->refcount);
67 ufence->addr = ptr;
68 ufence->value = value;
69 ufence->mm = current->mm;
70 mmgrab(ufence->mm);
71
72 return ufence;
73 }
74 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki