From: Ajith P V <ajithpv.linux@gmail.com>
To: FlorianSchandinat@gmx.de, deller@gmx.de
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, Ajith P V <ajithpv.linux@gmail.com>
Subject: [PATCH] video: fbdev: via: refactor deprecated strcpy
Date: Mon, 10 Aug 2026 12:19:08 +0000 [thread overview]
Message-ID: <20260810121908.31307-1-ajithpv.linux@gmail.com> (raw)
Replace the deprecated and unbounded strcpy() function with the safer
strscpy() alternative when setting up the framebuffer fixed screen
information [1][2].
The destination buffer `fix->id` is a fixed-size character array of
16 bytes. The source `viafb_name` is currently a static global string
literal ("Via"), which safely fits the destination and poses no active
overflow risk.
However, replacing strcpy() with strscpy() aligns this driver with
the ongoing kernel-wide security initiative to eliminate unbounded
string copies, hardening the code against future modifications.
This is a proactive API cleanup and there is no functional
performance or truncation risk since `viafb_name` safely fits inside
the 16-byte struct constraints.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
Link: https://github.com/KSPP/linux/issues/88 [2]
Signed-off-by: Ajith P V <ajithpv.linux@gmail.com>
---
drivers/video/fbdev/via/viafbdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
index 80f95dac32c8..925b56830fdd 100644
--- a/drivers/video/fbdev/via/viafbdev.c
+++ b/drivers/video/fbdev/via/viafbdev.c
@@ -144,7 +144,7 @@ static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
struct viafb_par *viaparinfo)
{
memset(fix, 0, sizeof(struct fb_fix_screeninfo));
- strcpy(fix->id, viafb_name);
+ strscpy(fix->id, viafb_name, sizeof(fix->id));
fix->smem_start = viaparinfo->fbmem;
fix->smem_len = viaparinfo->fbmem_free;
--
2.43.0
reply other threads:[~2026-08-10 12:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260810121908.31307-1-ajithpv.linux@gmail.com \
--to=ajithpv.linux@gmail.com \
--cc=FlorianSchandinat@gmx.de \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--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