drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -0
@@ -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
Signature · 1 line
1.9.1
Am 24.01.2017 um 10:25 schrieb Arvind Yadav:
Quoted 5 lines
Here, If
ioremap_nocachewill 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 <[email protected]>
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 <[email protected]>.
Regards,
Christian.
Quoted 9 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_ · line 559
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2
-0@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Christian König
Am 24.01.2017 um 10:25 schrieb Arvind Yadav:
Quoted 5 lines
Here, If
ioremap_nocachewill fail. It will return NULL. Kernel can run into a NULL-pointer dereference. This error check will avoid NULL pointer dereference.
Quoted 9 lines
Quoted 1 line
Signed-off-by Arvind Yadav <[email protected]>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 <[email protected]>.
Applied this and the radeon patch.
Alex
Quoted 21 lines
Regards,
Christian.Quoted 18 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0@@ -552,6 +552,8 @@ static int amdgpu_ttm_io_mem_reserve(struct
ttm_bo_device*bdev, structttm_mem_mem->bus.addr = ioremap_nocache(mem->bus.base + mem->bus.offset, mem->bus.size);drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2
-0+if (!mem->bus.addr) +return -ENOMEM ;/*
Quoted 8 lines
Quoted 1 line
* Alpha: Use just the bus offset plus
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel