Re: [PATCH] video: fbdev: via: refactor deprecated strcpy

From: Helge Deller

Date: Thu Aug 13 2026 - 12:01:11 EST


On 8/10/26 14:19, Ajith P V wrote:
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.

correct.

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.
Compilers often can optimize strcpy() but not strscpy().
So, why not simply dropping viafb_name and replace it with a constant string?
Or even make it 'const char viafb_name[] = "viafb";' and use this?
Then the compiler can detect any issues at compile time.

Helge