From: Helge Deller <deller@gmx.de>
To: Wang Jun <1742789905@qq.com>,
Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, gszhai@bjtu.edu.cn,
25125332@bjtu.edu.cn, 25125283@bjtu.edu.cn, 23120469@bjtu.edu.cn
Subject: Re: [PATCH] video/fbdev/via: check ioremap return value in viafb_lcd_get_mobile_state
Date: Tue, 10 Mar 2026 17:36:20 +0100 [thread overview]
Message-ID: <7fdc2a60-2f7d-49c2-b18e-5c5510c9c7cb@gmx.de> (raw)
In-Reply-To: <tencent_5706A404B952870FEAC83A04EEFC8348A305@qq.com>
On 3/10/26 02:14, Wang Jun wrote:
> 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.
correct.
> This patch adds a proper NULL check after ioremap()
yes.
> and returns
> -ENOMEM in case of failure.
You return "false", not -ENOMEM.
Anyway, I corrected this, dropped the DEBUG_MSG() call and applied it
to the fbdev git tree.
Thanks!
Helge
> Signed-off-by: Wang Jun <1742789905@qq.com>
> ---
> drivers/video/fbdev/via/lcd.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/video/fbdev/via/lcd.c b/drivers/video/fbdev/via/lcd.c
> index 8673fced8749..91359d2b64fb 100644
> --- a/drivers/video/fbdev/via/lcd.c
> +++ b/drivers/video/fbdev/via/lcd.c
> @@ -954,6 +954,10 @@ bool viafb_lcd_get_mobile_state(bool *mobile)
> u16 start_pattern;
>
> biosptr = ioremap(romaddr, 0x10000);
> + if (!biosptr) {
> + DEBUG_MSG(KERN_ERR " Failed to remap BIOS memory\n");
> + return false;
> + }
> start_pattern = readw(biosptr);
>
> /* Compare pattern */
next prev parent reply other threads:[~2026-03-10 16:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 1:14 [PATCH] video/fbdev/via: check ioremap return value in viafb_lcd_get_mobile_state Wang Jun
2026-03-10 16:36 ` Helge Deller [this message]
2026-03-11 3:49 ` Claude review: " Claude Code Review Bot
2026-03-11 3:49 ` Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7fdc2a60-2f7d-49c2-b18e-5c5510c9c7cb@gmx.de \
--to=deller@gmx.de \
--cc=1742789905@qq.com \
--cc=23120469@bjtu.edu.cn \
--cc=25125283@bjtu.edu.cn \
--cc=25125332@bjtu.edu.cn \
--cc=FlorianSchandinat@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gszhai@bjtu.edu.cn \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox