diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-10-12 06:17:30 (GMT) |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-13 22:25:50 (GMT) |
commit | eeb2fa0c97ba661f8b7fb210a1de10928b67a47b (patch) | |
tree | 3c194552a9b4ce732788d8486e2fa846bd1adae4 /drivers/gpu | |
parent | 9faa6b0277fab4ab91db4d69bc47566fdfbae48b (diff) | |
download | linux-eeb2fa0c97ba661f8b7fb210a1de10928b67a47b.tar.xz |
drm/amdgpu: potential NULL dereference in debugfs code
debugfs_create_file() returns NULL on error, it only returns error
pointers if debugfs isn't enabled in the config and we checked for that
earlier so it can't happen.
Fixes: 4f4824b55650 ('drm/amd/amdgpu: Convert ring debugfs entries to binary')
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index e1fa873..3cb5e90 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c @@ -345,8 +345,8 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev, ent = debugfs_create_file(name, S_IFREG | S_IRUGO, root, ring, &amdgpu_debugfs_ring_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); + if (!ent) + return -ENOMEM; i_size_write(ent->d_inode, ring->ring_size + 12); ring->ent = ent; |