The Linux Kernel Mailing List
 help / color / mirror / Atom feed
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 v4] video: fbdev: via: refactor strcpy and viafb_name
Date: Tue, 18 Aug 2026 11:17:22 +0000	[thread overview]
Message-ID: <20260818111722.471340-1-ajithpv.linux@gmail.com> (raw)

Eliminate the single-use file-scope variable `viafb_name` and pass the
"Via" string literal directly to strcpy().

Since "Via" is a literal constant, the compiler safely executes
compile-time bounds checking during fortify verification. This satisfies
the security initiative requirements while minimizing code complexity.

Signed-off-by: Ajith P V <ajithpv.linux@gmail.com>
---
v4:
  - Drop the variable entirely and use the literal string directly in
    strcpy() as suggested by Helge Deller.
v3:
  - Restore the original "Via" string value to prevent userspace ABI
    regressions, while keeping the 'static const char[]' optimization as
    suggested by Sashiko AI.
v2:
  - Keep variable static but change it to a const array
    'static const char viafb_name[] = "viafb"' as suggested by Helge Deller
    to let the compiler leverage compile-time checks.

 drivers/video/fbdev/via/viafbdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
index 80f95dac32c8..dd9374e8ad09 100644
--- a/drivers/video/fbdev/via/viafbdev.c
+++ b/drivers/video/fbdev/via/viafbdev.c
@@ -16,7 +16,6 @@
 #define _MASTER_FILE
 #include "global.h"
 
-static char *viafb_name = "Via";
 static u32 pseudo_pal[17];
 
 /* video mode */
@@ -144,7 +143,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);
+	strcpy(fix->id, "Via");
 
 	fix->smem_start = viaparinfo->fbmem;
 	fix->smem_len = viaparinfo->fbmem_free;
-- 
2.43.0


             reply	other threads:[~2026-08-18 11:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 11:17 Ajith P V [this message]
2026-08-18 12:25 ` [PATCH v4] video: fbdev: via: refactor strcpy and viafb_name 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=20260818111722.471340-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