* [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
@ 2017-01-24 9:25 Arvind Yadav
2017-01-24 9:55 ` Christian König
0 siblings, 1 reply; 5+ messages in thread
From: Arvind Yadav @ 2017-01-24 9:25 UTC (permalink / raw)
To: airlied; +Cc: dri-devel, linux-kernel
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>
---
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
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
2017-01-24 9:25 [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache Arvind Yadav
@ 2017-01-24 9:55 ` Christian König
0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2017-01-24 9:55 UTC (permalink / raw)
To: Arvind Yadav, airlied; +Cc: linux-kernel, dri-devel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
@ 2017-01-24 9:55 ` Christian König
0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2017-01-24 9:55 UTC (permalink / raw)
To: Arvind Yadav, airlied; +Cc: linux-kernel, dri-devel
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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
2017-01-24 9:55 ` Christian König
@ 2017-01-24 22:11 ` Alex Deucher
-1 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2017-01-24 22:11 UTC (permalink / raw)
To: Christian König
Cc: Arvind Yadav, Dave Airlie, LKML, Maling list - DRI developers
On Tue, Jan 24, 2017 at 4:55 AM, Christian König
<deathsimple@vodafone.de> wrote:
> 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>.
>
Applied this and the radeon patch.
Alex
> 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
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
@ 2017-01-24 22:11 ` Alex Deucher
0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2017-01-24 22:11 UTC (permalink / raw)
To: Christian König; +Cc: Arvind Yadav, LKML, Maling list - DRI developers
On Tue, Jan 24, 2017 at 4:55 AM, Christian König
<deathsimple@vodafone.de> wrote:
> 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>.
>
Applied this and the radeon patch.
Alex
> 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
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-24 22:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 9:25 [PATCH] drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache Arvind Yadav
2017-01-24 9:55 ` Christian König
2017-01-24 9:55 ` Christian König
2017-01-24 22:11 ` Alex Deucher
2017-01-24 22:11 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.