Re: [PATCH v2 3/3] drm/amdgpu: use drm_file name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pierre-Eric,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-exynos/exynos-drm-next]
[also build test WARNING on drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master v6.11 next-20240919]
[cannot apply to drm/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/Pierre-Eric-Pelloux-Prayer/drm-use-drm_file-name-in-fdinfo/20240916-213521
base:   https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
patch link:    https://lore.kernel.org/r/20240916133223.1023773-3-pierre-eric.pelloux-prayer%40amd.com
patch subject: [PATCH v2 3/3] drm/amdgpu: use drm_file name
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240920/202409200113.0AEe5YG9-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240920/202409200113.0AEe5YG9-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/202409200113.0AEe5YG9-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:997:32: warning: variable 'file' is uninitialized when used here [-Wuninitialized]
     997 |         r = mutex_lock_interruptible(&file->name_lock);
         |                                       ^~~~
   include/linux/mutex.h:162:72: note: expanded from macro 'mutex_lock_interruptible'
     162 | #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0)
         |                                                                        ^~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:990:23: note: initialize the variable 'file' to silence this warning
     990 |         struct drm_file *file;
         |                              ^
         |                               = NULL
   1 warning generated.


vim +/file +997 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

   984	
   985	#if defined(CONFIG_DEBUG_FS)
   986	static int amdgpu_debugfs_gem_info_show(struct seq_file *m, void *unused)
   987	{
   988		struct amdgpu_device *adev = m->private;
   989		struct drm_device *dev = adev_to_drm(adev);
   990		struct drm_file *file;
   991		int r;
   992	
   993		r = mutex_lock_interruptible(&dev->filelist_mutex);
   994		if (r)
   995			return r;
   996	
 > 997		r = mutex_lock_interruptible(&file->name_lock);
   998		if (r)
   999			goto out;
  1000	
  1001		list_for_each_entry(file, &dev->filelist, lhead) {
  1002			struct task_struct *task;
  1003			struct drm_gem_object *gobj;
  1004			struct pid *pid;
  1005			int id;
  1006	
  1007			/*
  1008			 * Although we have a valid reference on file->pid, that does
  1009			 * not guarantee that the task_struct who called get_pid() is
  1010			 * still alive (e.g. get_pid(current) => fork() => exit()).
  1011			 * Therefore, we need to protect this ->comm access using RCU.
  1012			 */
  1013			rcu_read_lock();
  1014			pid = rcu_dereference(file->pid);
  1015			task = pid_task(pid, PIDTYPE_TGID);
  1016			seq_printf(m, "pid %8d command %s", pid_nr(pid),
  1017					   task ? task->comm : "<unknown>");
  1018			if (file->name) {
  1019				seq_putc(m, '/');
  1020				seq_puts(m, file->name);
  1021			}
  1022			seq_puts(m, ":\n");
  1023			rcu_read_unlock();
  1024	
  1025			spin_lock(&file->table_lock);
  1026			idr_for_each_entry(&file->object_idr, gobj, id) {
  1027				struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
  1028	
  1029				amdgpu_bo_print_info(id, bo, m);
  1030			}
  1031			spin_unlock(&file->table_lock);
  1032		}
  1033		mutex_unlock(&file->name_lock);
  1034	out:
  1035		mutex_unlock(&dev->filelist_mutex);
  1036		return 0;
  1037	}
  1038	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux