* [PATCH] drm: radeon: radeon_ttm: Handle return NULL error from ioremap_nocache
@ 2017-01-24 9:16 Arvind Yadav
0 siblings, 0 replies; only message in thread
From: Arvind Yadav @ 2017-01-24 9:16 UTC (permalink / raw)
To: airlied; +Cc: alexander.deucher, christian.koenig, dri-devel, linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-01-24 9:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 9:16 [PATCH] drm: radeon: radeon_ttm: Handle return NULL error from ioremap_nocache Arvind Yadav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®