Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565738 > unrolled thread

[PATCH] drm: radeon: radeon_ttm: Handle return NULL error from ioremap_nocache

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-01-24 10:20 +0100
Last post2017-01-24 10:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm: radeon: radeon_ttm: Handle return NULL error from ioremap_nocache Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-01-24 10:20 +0100

#1565738 — [PATCH] drm: radeon: radeon_ttm: Handle return NULL error from ioremap_nocache

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-01-24 10:20 +0100
Subject[PATCH] drm: radeon: radeon_ttm: Handle return NULL error from ioremap_nocache
Message-ID<t35qF-2qR-7@gated-at.bofh.it>
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>
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 0cf03cc..fc129fd 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
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web