From: "Christian König" <deathsimple@vodafone.de>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>, airlied@linux.ie
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
Date: Tue, 24 Jan 2017 10:55:37 +0100 [thread overview]
Message-ID: <aca57911-e74f-a917-9b3a-5c10a2542940@vodafone.de> (raw)
In-Reply-To: <1485249933-1055-1-git-send-email-arvind.yadav.cs@gmail.com>
Am 24.01.2017 um 10:25 schrieb Arvind Yadav:
> Here, If ioremap_nocache will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference.
> This error check will avoid NULL pointer dereference.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
I'm not 100% sure if ioremap_nocache() can actually return NULL on
platforms where this matters, but if that's the case the patch looks
reasonable on first glance.
So it is Reviewed-by: Christian König <christian.koenig@amd.com>.
Regards,
Christian.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 8e35c1f..610c88f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -552,6 +552,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
> mem->bus.addr =
> ioremap_nocache(mem->bus.base + mem->bus.offset,
> mem->bus.size);
> + if (!mem->bus.addr)
> + return -ENOMEM;
>
> /*
> * Alpha: Use just the bus offset plus
next prev parent reply other threads:[~2017-01-24 9:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 9:25 Arvind Yadav
2017-01-24 9:55 ` Christian König [this message]
2017-01-24 22:11 ` Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aca57911-e74f-a917-9b3a-5c10a2542940@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=airlied@linux.ie \
--cc=arvind.yadav.cs@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®