From: Arvind Yadav Date: Tue, 24 Jan 2017 09:16:16 +0000 (+0530) Subject: drm: radeon: radeon_ttm: Handle return NULL error from ioremap_nocache X-Git-Tag: v4.14-rc1~1422^2~31^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b2c69328280278593e0cd87e83da51bbc748ce7;p=platform%2Fkernel%2Flinux-rpi3.git drm: radeon: radeon_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. Signed-off-by: Arvind Yadav Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 7e3eb8e..7a10b38 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -502,6 +502,8 @@ static int radeon_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