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-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b2c69328280278593e0cd87e83da51bbc748ce7;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.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 7e3eb8e80095..7a10b3852970 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