From: Wang Jun <1742789905@qq.com> Date: Tue, 10 Mar 2026 01:14:20 +0000 (+0800) Subject: fbdev: viafb: check ioremap return value in viafb_lcd_get_mobile_state X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f044788088ef55e9855b17b7984ffe522c40c093;p=thirdparty%2Flinux.git fbdev: viafb: check ioremap return value in viafb_lcd_get_mobile_state The function viafb_lcd_get_mobile_state() calls ioremap() without checking the return value. If ioremap() fails (returns NULL), the subsequent readw() will cause a NULL pointer dereference. Signed-off-by: Wang Jun <1742789905@qq.com> Signed-off-by: Helge Deller --- diff --git a/drivers/video/fbdev/via/lcd.c b/drivers/video/fbdev/via/lcd.c index 8673fced87492..3fa2304fbda7e 100644 --- a/drivers/video/fbdev/via/lcd.c +++ b/drivers/video/fbdev/via/lcd.c @@ -954,6 +954,9 @@ bool viafb_lcd_get_mobile_state(bool *mobile) u16 start_pattern; biosptr = ioremap(romaddr, 0x10000); + if (!biosptr) + return false; + start_pattern = readw(biosptr); /* Compare pattern */