From: Arvind Yadav Date: Tue, 24 Jan 2017 09:25:33 +0000 (+0530) Subject: drm/amd/amdgpu/amdgpu_ttm: Handle return NULL error from ioremap_nocache X-Git-Tag: v4.14-rc1~1422^2~31^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ba28ac9f5cc36f91b64273b11d302e02bd77508;p=platform%2Fkernel%2Flinux-rpi3.git 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. Reviewed-by: Christian König Signed-off-by: Arvind Yadav Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 10e9b69..1154b0a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -548,6 +548,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