summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-04-26 10:49:20 +0200
committerAlex Deucher <alexander.deucher@amd.com>2022-04-26 17:52:57 +0200
commit2f33a397e9605e70fe2082d727aa1501a9386b95 (patch)
treefe32be1f9d186703539f6a009cce6a691f0cb5e6 /drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
parentdrm/amdgpu: debugfs: fix error codes in write functions (diff)
downloadlinux-2f33a397e9605e70fe2082d727aa1501a9386b95.tar.xz
linux-2f33a397e9605e70fe2082d727aa1501a9386b95.zip
drm/amdgpu: debugfs: fix NULL dereference in ta_if_invoke_debugfs_write()
If the kzalloc() fails then this code will crash. Return -ENOMEM instead. Fixes: e50d9ba0d2cd ("drm/amdgpu: Add debugfs TA load/unload/invoke support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
index 32bcc20b9e3f..6806deb098d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
@@ -254,7 +254,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size
shared_buf = kzalloc(shared_buf_len, GFP_KERNEL);
if (!shared_buf)
- ret = -ENOMEM;
+ return -ENOMEM;
if (copy_from_user((void *)shared_buf, &buf[copy_pos], shared_buf_len)) {
ret = -EFAULT;
goto err_free_shared_buf;