Message ID | 20190314073027.22337-1-kjlu@umn.edu (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | video: hgafb: fix a NULL pointer dereference | expand |
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
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;
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(+)