From: Kangjie Lu Date: Mon, 1 Apr 2019 15:46:58 +0000 (+0200) Subject: video: hgafb: fix potential NULL pointer dereference X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ec7f6aad57ad29e4e66cc2e18e1e1599ddb02542;p=openwrt%2Fstaging%2Fblogic.git video: hgafb: fix potential 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 Cc: Aditya Pakki Cc: Ferenc Bakonyi [b.zolnierkie: minor patch summary fixup] Signed-off-by: Bartlomiej Zolnierkiewicz --- 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;