* [patch] drm/amdgpu: potential NULL dereference in debugfs code
@ 2016-10-12 6:17 Dan Carpenter
2016-10-12 9:20 ` Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-10-12 6:17 UTC (permalink / raw)
To: Alex Deucher, Tom St Denis
Cc: Jammy Zhou, kernel-janitors, linux-kernel, dri-devel,
Junwei Zhang, Christian König, Monk Liu
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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 85aeb0a..8d16eaf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -371,8 +371,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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] drm/amdgpu: potential NULL dereference in debugfs code
2016-10-12 6:17 [patch] drm/amdgpu: potential NULL dereference in debugfs code Dan Carpenter
@ 2016-10-12 9:20 ` Christian König
2016-10-12 16:48 ` Alex Deucher
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2016-10-12 9:20 UTC (permalink / raw)
To: Dan Carpenter, Alex Deucher, Tom St Denis
Cc: Jammy Zhou, kernel-janitors, linux-kernel, dri-devel,
Junwei Zhang, Monk Liu
Am 12.10.2016 um 08:17 schrieb Dan Carpenter:
> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christian König <christian.koenig@amd.com>.
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index 85aeb0a..8d16eaf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -371,8 +371,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;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] drm/amdgpu: potential NULL dereference in debugfs code
2016-10-12 9:20 ` Christian König
@ 2016-10-12 16:48 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2016-10-12 16:48 UTC (permalink / raw)
To: Christian König
Cc: Tom St Denis, Jammy Zhou, kernel-janitors, LKML,
Maling list - DRI developers, Junwei Zhang, Monk Liu,
Alex Deucher, Dan Carpenter
On Wed, Oct 12, 2016 at 5:20 AM, Christian König
<christian.koenig@amd.com> wrote:
> Am 12.10.2016 um 08:17 schrieb Dan Carpenter:
>>
>> 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')
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>.
>
Applied. thanks!
Alex
>
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> index 85aeb0a..8d16eaf 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> @@ -371,8 +371,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;
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-12 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 6:17 [patch] drm/amdgpu: potential NULL dereference in debugfs code Dan Carpenter
2016-10-12 9:20 ` Christian König
2016-10-12 16:48 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).