[PATCH] video: hgafb: fix a NULL pointer dereference

Subsystems: framebuffer layer, the rest

STALE2715d

2 messages, 2 authors, 2019-04-01 · open the first message on its own page

[PATCH] video: hgafb: fix a NULL pointer dereference

From: Kangjie Lu <hidden>
Date: 2019-03-14 07:30:38

When ioremap fails, hga_vram should not be dereferenced. The fix
check the failure to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <redacted>
---
 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

Re: [PATCH] video: hgafb: fix a NULL pointer dereference

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2019-04-01 14:41:27

On 03/14/2019 08:30 AM, Kangjie Lu wrote:
When ioremap fails, hga_vram should not be dereferenced. The fix
check the failure to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <redacted>
Patch queued for v5.2 with minor change in the patch summary
("video: hgafb: fix potential NULL pointer dereference"), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help