Re: [PATCH] drm/msm/gem: Add some cleanup.h
From: kernel test robot
Date: Tue Oct 27 2026 - 07:35:53 EST
Hi Rob,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm/drm-next]
[also build test WARNING on drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-tip/drm-tip linus/master v7.3 next-20261026]
[cannot apply to drm-misc/drm-misc-next daeinki-drm-exynos/exynos-drm-next]
[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/Rob-Clark/drm-msm-gem-Add-some-cleanup-h/20261026-143700
base: https://gitlab.freedesktop.org/drm/kernel.git drm-next
patch link: https://lore.kernel.org/r/20261026213701.22126-1-robin.clark%40oss.qualcomm.com
patch subject: [PATCH] drm/msm/gem: Add some cleanup.h
config: x86_64-buildonly-randconfig-1005-20261027 (https://download.01.org/0day-ci/archive/20261027/202610271940.hGm7dpnG-lkp@xxxxxxxxx/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261027/202610271940.hGm7dpnG-lkp@xxxxxxxxx/reproduce)
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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610271940.hGm7dpnG-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/msm/msm_drv.c:613:13: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
613 | } else if (copy_to_user(metadata, buf, len)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/msm_drv.c:621:9: note: uninitialized use occurs here
621 | return ret;
| ^~~
drivers/gpu/drm/msm/msm_drv.c:613:9: note: remove the 'if' if its condition is always true
613 | } else if (copy_to_user(metadata, buf, len)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
614 | ret = -EFAULT;
615 | } else {
| ~~~~~~
616 | *metadata_size = len;
| ~~~~~~~~~~~~~~~~~~~~~
617 | }
| ~
drivers/gpu/drm/msm/msm_drv.c:588:9: note: initialize the variable 'ret' to silence this warning
588 | int ret, len;
| ^
| = 0
1 warning generated.
vim +613 drivers/gpu/drm/msm/msm_drv.c
9902cb999e4e91 Rob Clark 2023-11-06 581
9902cb999e4e91 Rob Clark 2023-11-06 582 static int msm_ioctl_gem_info_get_metadata(struct drm_gem_object *obj,
9902cb999e4e91 Rob Clark 2023-11-06 583 __user void *metadata,
9902cb999e4e91 Rob Clark 2023-11-06 584 u32 *metadata_size)
9902cb999e4e91 Rob Clark 2023-11-06 585 {
9902cb999e4e91 Rob Clark 2023-11-06 586 struct msm_gem_object *msm_obj = to_msm_bo(obj);
9902cb999e4e91 Rob Clark 2023-11-06 587 void *buf;
9902cb999e4e91 Rob Clark 2023-11-06 588 int ret, len;
9902cb999e4e91 Rob Clark 2023-11-06 589
9902cb999e4e91 Rob Clark 2023-11-06 590 if (!metadata) {
9902cb999e4e91 Rob Clark 2023-11-06 591 /*
9902cb999e4e91 Rob Clark 2023-11-06 592 * Querying the size is inherently racey, but
9902cb999e4e91 Rob Clark 2023-11-06 593 * EXT_external_objects expects the app to confirm
9902cb999e4e91 Rob Clark 2023-11-06 594 * via device and driver UUIDs that the exporter and
9902cb999e4e91 Rob Clark 2023-11-06 595 * importer versions match. All we can do from the
9902cb999e4e91 Rob Clark 2023-11-06 596 * kernel side is check the length under obj lock
9902cb999e4e91 Rob Clark 2023-11-06 597 * when userspace tries to retrieve the metadata
9902cb999e4e91 Rob Clark 2023-11-06 598 */
9902cb999e4e91 Rob Clark 2023-11-06 599 *metadata_size = msm_obj->metadata_size;
9902cb999e4e91 Rob Clark 2023-11-06 600 return 0;
9902cb999e4e91 Rob Clark 2023-11-06 601 }
9902cb999e4e91 Rob Clark 2023-11-06 602
fec06716d04d17 Rob Clark 2026-10-26 603 scoped_cond_guard (gem_lock_intr, return -EINTR, obj) {
fec06716d04d17 Rob Clark 2026-10-26 604 /* Avoid copy_to_user() under gem obj lock by making a copy: */
9902cb999e4e91 Rob Clark 2023-11-06 605 len = msm_obj->metadata_size;
9902cb999e4e91 Rob Clark 2023-11-06 606 buf = kmemdup(msm_obj->metadata, len, GFP_KERNEL);
fec06716d04d17 Rob Clark 2026-10-26 607 if (!buf)
47cbfe2608314b Yasuaki Torimaru 2026-03-25 608 return -ENOMEM;
47cbfe2608314b Yasuaki Torimaru 2026-03-25 609 }
47cbfe2608314b Yasuaki Torimaru 2026-03-25 610
9902cb999e4e91 Rob Clark 2023-11-06 611 if (*metadata_size < len) {
9902cb999e4e91 Rob Clark 2023-11-06 612 ret = -ETOOSMALL;
9902cb999e4e91 Rob Clark 2023-11-06 @613 } else if (copy_to_user(metadata, buf, len)) {
9902cb999e4e91 Rob Clark 2023-11-06 614 ret = -EFAULT;
9902cb999e4e91 Rob Clark 2023-11-06 615 } else {
9902cb999e4e91 Rob Clark 2023-11-06 616 *metadata_size = len;
9902cb999e4e91 Rob Clark 2023-11-06 617 }
9902cb999e4e91 Rob Clark 2023-11-06 618
9902cb999e4e91 Rob Clark 2023-11-06 619 kfree(buf);
9902cb999e4e91 Rob Clark 2023-11-06 620
47cbfe2608314b Yasuaki Torimaru 2026-03-25 621 return ret;
9902cb999e4e91 Rob Clark 2023-11-06 622 }
9902cb999e4e91 Rob Clark 2023-11-06 623
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki