Skip to content

Commit 03d5236

Browse files
amd-sukhatriChristianKoenigAMD
authored andcommitted
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 <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Sunil Khatri <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Christian König <[email protected]> Signed-off-by: Christian König <[email protected]>
1 parent 8f9abaf commit 03d5236

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,7 @@ static int amdgpu_pt_info_read(struct seq_file *m, void *unused)
21432143
return -EINVAL;
21442144

21452145
fpriv = file->driver_priv;
2146-
if (!fpriv && !fpriv->vm.root.bo)
2146+
if (!fpriv || !fpriv->vm.root.bo)
21472147
return -ENODEV;
21482148

21492149
root_bo = amdgpu_bo_ref(fpriv->vm.root.bo);

0 commit comments

Comments
 (0)