[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d178bc4-49e3-4073-2ccc-d0d196d6f5db@amd.com>
Date: Wed, 12 Oct 2016 11:20:41 +0200
From: Christian König <christian.koenig@....com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Alex Deucher <alexander.deucher@....com>,
Tom St Denis <tom.stdenis@....com>
CC: David Airlie <airlied@...ux.ie>,
Chunming Zhou <David1.Zhou@....com>,
"Monk Liu" <Monk.Liu@....com>, Junwei Zhang <Jerry.Zhang@....com>,
Jammy Zhou <Jammy.Zhou@....com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<kernel-janitors@...r.kernel.org>
Subject: Re: [patch] drm/amdgpu: potential NULL dereference in debugfs code
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@...cle.com>
Reviewed-by: Christian König <christian.koenig@....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;
Powered by blists - more mailing lists