From f044788088ef55e9855b17b7984ffe522c40c093 Mon Sep 17 00:00:00 2001 From: Wang Jun <1742789905@qq.com> Date: Tue, 10 Mar 2026 09:14:20 +0800 Subject: [PATCH] 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 --- drivers/video/fbdev/via/lcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbdev/via/lcd.c b/drivers/video/fbdev/via/lcd.c index 8673fced8749..3fa2304fbda7 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 */