diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-01-24 04:25:33 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-01-27 12:20:38 -0500 |
commit | 8ba28ac9f5cc36f91b64273b11d302e02bd77508 (patch) | |
tree | 68aff7e691359fc5db0d797c4bcd1d7cca6de0f6 /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
parent | 967de2a9dcd52b248e447608fa03d30db4eb05ed (diff) |
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 <christian.koenig@amd.com>
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/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 10e9b690676e..1154b0a8881d 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_ | |||
548 | mem->bus.addr = | 548 | mem->bus.addr = |
549 | ioremap_nocache(mem->bus.base + mem->bus.offset, | 549 | ioremap_nocache(mem->bus.base + mem->bus.offset, |
550 | mem->bus.size); | 550 | mem->bus.size); |
551 | if (!mem->bus.addr) | ||
552 | return -ENOMEM; | ||
551 | 553 | ||
552 | /* | 554 | /* |
553 | * Alpha: Use just the bus offset plus | 555 | * Alpha: Use just the bus offset plus |