From: Sunil Khatri Date: Wed, 9 Jul 2025 07:16:18 +0000 (+0530) Subject: drm/amdgpu: fix the logic to validate fpriv and root bo X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=03d5236014a5d298c26b2ca80e5834aa844574b3;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu: fix the logic to validate fpriv and root bo Fix the smatch warning, smatch warnings: drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:2146 amdgpu_pt_info_read() error: we previously assumed 'fpriv' could be null (see line 2146) "if (!fpriv && !fpriv->vm.root.bo)", It has to be an OR condition rather than an AND which makes an NULL dereference in case fpriv is NULL. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202507090525.9rDWGhz3-lkp@intel.com/ Signed-off-by: Sunil Khatri Link: https://lore.kernel.org/r/20250709071618.591866-1-sunil.khatri@amd.com Reviewed-by: Christian König Signed-off-by: Christian König --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index 2353455d4aff8..0e6e2e2acf5b5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -2143,7 +2143,7 @@ static int amdgpu_pt_info_read(struct seq_file *m, void *unused) return -EINVAL; fpriv = file->driver_priv; - if (!fpriv && !fpriv->vm.root.bo) + if (!fpriv || !fpriv->vm.root.bo) return -ENODEV; root_bo = amdgpu_bo_ref(fpriv->vm.root.bo);