Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Yue Bing Kun <yuebingkun@kylinos.cn>
To: Helge Deller <deller@gmx.de>
Cc: Nathan Chancellor <nathan@kernel.org>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3] fbdev: platinumfb: add error checking for ioremap calls
Date: Thu, 20 Aug 2026 14:00:26 +0800	[thread overview]
Message-ID: <20260820060026.217814-1-yuebingkun@kylinos.cn> (raw)

From: BingKun Yue <yuebingkun@kylinos.cn>

The ioremap() and ioremap_wt() calls in platinumfb_probe() were not
checked for failure. If any of these mappings fail, the driver would
dereference NULL pointers, leading to a kernel panic.

Add proper error checking and use goto-based cleanup to avoid code
duplication across the error paths.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/linux-fbdev/20260819235918.GA2021182@ax162/
Signed-off-by: BingKun Yue <yuebingkun@kylinos.cn>
---
 drivers/video/fbdev/platinumfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/platinumfb.c b/drivers/video/fbdev/platinumfb.c
index fdffadcc3e73..f74c937c839f 100644
--- a/drivers/video/fbdev/platinumfb.c
+++ b/drivers/video/fbdev/platinumfb.c
@@ -320,7 +320,7 @@ static void platinum_init_info(struct fb_info *info,
 	fb_alloc_cmap(&info->cmap, 256, 0);
 
 	/* Fill fix common fields */
-	strscpy(info->fix.id, "platinum", sizeof(info->fix.id));
+	strcpy(info->fix.id, "platinum");
 	info->fix.mmio_start = pinfo->platinum_regs_phys;
 	info->fix.mmio_len = 0x1000;
 	info->fix.type = FB_TYPE_PACKED_PIXELS;
-- 
2.43.0


             reply	other threads:[~2026-08-20  6:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20  6:00 Yue Bing Kun [this message]
2026-08-20 11:55 ` [PATCH v3] fbdev: platinumfb: add error checking for ioremap calls Helge Deller

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=20260820060026.217814-1-yuebingkun@kylinos.cn \
    --to=yuebingkun@kylinos.cn \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@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