Skip to content

Commit f5d873f

Browse files
committed
drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
Avoid a possible buffer overflow if size is larger than 4K. Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 7ba9395 commit f5d873f

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
@@ -402,7 +402,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, siz
402402
int r;
403403
uint32_t *data, x;
404404

405-
if (size & 0x3 || *pos & 0x3)
405+
if (size > 4096 || size & 0x3 || *pos & 0x3)
406406
return -EINVAL;
407407

408408
r = pm_runtime_get_sync(adev_to_drm(adev)->dev);

0 commit comments

Comments
 (0)