提交 eeb2fa0c 编写于 作者: D Dan Carpenter 提交者: Alex Deucher

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: 4f4824b5 ('drm/amd/amdgpu: Convert ring debugfs entries to binary')
Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 9faa6b02
...@@ -345,8 +345,8 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev, ...@@ -345,8 +345,8 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
ent = debugfs_create_file(name, ent = debugfs_create_file(name,
S_IFREG | S_IRUGO, root, S_IFREG | S_IRUGO, root,
ring, &amdgpu_debugfs_ring_fops); ring, &amdgpu_debugfs_ring_fops);
if (IS_ERR(ent)) if (!ent)
return PTR_ERR(ent); return -ENOMEM;
i_size_write(ent->d_inode, ring->ring_size + 12); i_size_write(ent->d_inode, ring->ring_size + 12);
ring->ent = ent; ring->ent = ent;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册