Skip to content

Commit b509b1c

Browse files
kengitergregkh
authored andcommitted
video: hgafb: fix potential NULL pointer dereference
[ Upstream commit ec7f6aa ] When ioremap fails, hga_vram should not be dereferenced. The fix check the failure to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <[email protected]> Cc: Aditya Pakki <[email protected]> Cc: Ferenc Bakonyi <[email protected]> [b.zolnierkie: minor patch summary fixup] Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent a0bb059 commit b509b1c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/video/fbdev/hgafb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ static int hga_card_detect(void)
285285
hga_vram_len = 0x08000;
286286

287287
hga_vram = ioremap(0xb0000, hga_vram_len);
288+
if (!hga_vram)
289+
goto error;
288290

289291
if (request_region(0x3b0, 12, "hgafb"))
290292
release_io_ports = 1;

0 commit comments

Comments
 (0)