]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fbdev: viafb: check ioremap return value in viafb_lcd_get_mobile_state
authorWang Jun <1742789905@qq.com>
Tue, 10 Mar 2026 01:14:20 +0000 (09:14 +0800)
committerHelge Deller <deller@gmx.de>
Tue, 10 Mar 2026 16:32:35 +0000 (17:32 +0100)
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 <deller@gmx.de>
drivers/video/fbdev/via/lcd.c

index 8673fced87492fd63ca21c188a6d0f7745460750..3fa2304fbda7e1fc93e499cd7b01232ad7a3553e 100644 (file)
@@ -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 */