mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Ajith P V <ajithpv.linux@gmail.com>, FlorianSchandinat@gmx.de
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] video: fbdev: via: refactor deprecated strcpy
Date: Thu, 13 Aug 2026 17:55:17 +0200	[thread overview]
Message-ID: <3f3c8baf-1409-4fe9-a8a6-c64a7e5f5a4f@gmx.de> (raw)
In-Reply-To: <20260810121908.31307-1-ajithpv.linux@gmail.com>

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

      reply	other threads:[~2026-08-13 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 12:19 Ajith P V
2026-08-13 15:55 ` Helge Deller [this message]

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=3f3c8baf-1409-4fe9-a8a6-c64a7e5f5a4f@gmx.de \
    --to=deller@gmx.de \
    --cc=FlorianSchandinat@gmx.de \
    --cc=ajithpv.linux@gmail.com \
    --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

all inboxes | Powered by JetHome®