summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_ttm.c
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2017-01-24 12:16:16 +0300
committerAlex Deucher <alexander.deucher@amd.com>2017-01-27 20:20:38 +0300
commit3b2c69328280278593e0cd87e83da51bbc748ce7 (patch)
tree47c0830e6e6d82aeee746b0c48e9546135c41042 /drivers/gpu/drm/radeon/radeon_ttm.c
parent8ba28ac9f5cc36f91b64273b11d302e02bd77508 (diff)
downloadlinux-3b2c69328280278593e0cd87e83da51bbc748ce7.tar.xz
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 <arvind.yadav.cs@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c2
1 files changed, 2 insertions, 0 deletions
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