All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: fbdev: via: check the return value of ioremap() in viafb_lcd_get_mobile_state()
@ 2022-02-25 12:45 Jia-Ju Bai
  0 siblings, 0 replies; only message in thread
From: Jia-Ju Bai @ 2022-02-25 12:45 UTC (permalink / raw)
  To: rajur, davem, kuba; +Cc: netdev, linux-kernel, Jia-Ju Bai

The function ioremap() in viafb_lcd_get_mobile_state() can fail, so its
return value should be checked.

Fixes: ac6c97e20f1b ("viafb: lcd.c, lcd.h, lcdtbl.h")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/video/fbdev/via/lcd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/via/lcd.c b/drivers/video/fbdev/via/lcd.c
index 088b962076b5..9aa331a4a605 100644
--- a/drivers/video/fbdev/via/lcd.c
+++ b/drivers/video/fbdev/via/lcd.c
@@ -954,6 +954,8 @@ 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 */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-25 12:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 12:45 [PATCH] video: fbdev: via: check the return value of ioremap() in viafb_lcd_get_mobile_state() Jia-Ju Bai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.