mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] video: hgafb: fix a NULL pointer dereference
@ 2019-03-14  7:30 ` Kangjie Lu
  2019-04-01 14:41   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-14  7:30 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Ferenc Bakonyi, Bartlomiej Zolnierkiewicz,
	linux-nvidia, dri-devel, linux-fbdev, linux-kernel

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>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] video: hgafb: fix a NULL pointer dereference
  2019-03-14  7:30 ` [PATCH] video: hgafb: fix a NULL pointer dereference Kangjie Lu
@ 2019-04-01 14:41   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-04-01 14:41 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Ferenc Bakonyi, linux-nvidia, dri-devel, linux-fbdev,
	linux-kernel


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 <kjlu@umn.edu>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-01 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190314073039epcas3p29225f2fcf1102266ce8265811f7f244e@epcas3p2.samsung.com>
2019-03-14  7:30 ` [PATCH] video: hgafb: fix a NULL pointer dereference Kangjie Lu
2019-04-01 14:41   ` Bartlomiej Zolnierkiewicz

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®