summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-04-01 18:46:58 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-15 12:53:04 +0300
commit317cc03af259accb428eb28c63619c3ff195f0d7 (patch)
tree15f6485f89c27f44964be28666631c656d165e24 /drivers/video
parent15337c4e4e86bf850335552e55262c24dc5fdb7e (diff)
downloadlinux-317cc03af259accb428eb28c63619c3ff195f0d7.tar.xz
video: hgafb: fix potential NULL pointer dereference
[ Upstream commit ec7f6aad57ad29e4e66cc2e18e1e1599ddb02542 ] 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@umn.edu> Cc: Aditya Pakki <pakki001@umn.edu> Cc: Ferenc Bakonyi <fero@drama.obuda.kando.hu> [b.zolnierkie: minor patch summary fixup] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/hgafb.c2
1 files changed, 2 insertions, 0 deletions
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;