[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190314073027.22337-1-kjlu@umn.edu>
Date: Thu, 14 Mar 2019 02:30:27 -0500
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Ferenc Bakonyi <fero@...ma.obuda.kando.hu>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
linux-nvidia@...ts.surfsouth.com, dri-devel@...ts.freedesktop.org,
linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] video: hgafb: fix a NULL pointer dereference
When ioremap fails, hga_vram should not be dereferenced. The fix
check the failure to avoid NULL pointer dereference.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
drivers/video/fbdev/hgafb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c
index 463028543173..59e1cae57948 100644
--- a/drivers/video/fbdev/hgafb.c
+++ b/drivers/video/fbdev/hgafb.c
@@ -285,6 +285,8 @@ static int hga_card_detect(void)
hga_vram_len = 0x08000;
hga_vram = ioremap(0xb0000, hga_vram_len);
+ if (!hga_vram)
+ goto error;
if (request_region(0x3b0, 12, "hgafb"))
release_io_ports = 1;
--
2.17.1
Powered by blists - more mailing lists