The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Geraldo Nascimento <geraldogabriel@gmail.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: "Alexander A. Klimov" <grandmaster@al2klimov.de>,
	Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	Kees Cook <kees@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nick Li <nick.li@foursemi.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	linux-edac@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-sound@vger.kernel.org
Subject: Re: [PATCH] Fix possible strscpy() buffer overflows
Date: Sun, 10 May 2026 22:30:20 -0300	[thread overview]
Message-ID: <agExLK2GR0w0Z_N2@geday> (raw)
In-Reply-To: <20260510230853.154050a2@pumpkin>

Hi David,

On Sun, May 10, 2026 at 11:08:53PM +0100, David Laight wrote:
> On Sun, 10 May 2026 20:24:41 +0200
> "Alexander A. Klimov" <grandmaster@al2klimov.de> wrote:
> 
> > In the changed files, strings were copied like this:
> > 
> >      strscpy(DST, SRC, strlen(SRC));
> > 
> > A buffer overflow would happen if strlen(SRC) > sizeof(DST).
> > Actually, strscpy() must be used this way:
> > 
> >      strscpy(DST, SRC, sizeof(DST));
> >      strscpy(DST, SRC); // defaults to sizeof(DST)
> 
> Nak.
> 
> This is test code and deliberately doing things 'wrong'.
> 
> -- David

while the change to fortify.c is what you described, the other two look
like good catches to me.

Thanks,
Geraldo Nascimento
> 
> > 
> > Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
> > ---
> >   drivers/edac/versalnet_edac.c | 3 +--
> >   drivers/misc/lkdtm/fortify.c  | 6 +-----
> >   sound/soc/codecs/fs210x.c     | 2 +-
> >   3 files changed, 3 insertions(+), 8 deletions(-)

  reply	other threads:[~2026-05-11  1:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 18:24 [PATCH] Fix possible strscpy() buffer overflows Alexander A. Klimov
2026-05-10 22:08 ` David Laight
2026-05-11  1:30   ` Geraldo Nascimento [this message]
2026-05-11  6:46     ` Andrei Purdea
2026-05-11 10:38       ` Borislav Petkov
2026-05-11 11:58         ` David Laight
2026-05-11 11:59         ` Andrei Purdea
2026-05-11 12:51           ` Borislav Petkov
2026-05-11 13:13             ` Andrei Purdea
2026-05-11 13:39               ` Borislav Petkov
2026-05-11 15:06                 ` Andrei Purdea
2026-05-11 19:15             ` David Laight

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=agExLK2GR0w0Z_N2@geday \
    --to=geraldogabriel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=broonie@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --cc=grandmaster@al2klimov.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nick.li@foursemi.com \
    --cc=perex@perex.cz \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=tiwai@suse.com \
    --cc=tony.luck@intel.com \
    /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