Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: liam.r.girdwood@linux.intel.com, peter.ujfalusi@linux.intel.com,
	yung-chuan.liao@linux.intel.com,
	ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
	pierre-louis.bossart@linux.dev, broonie@kernel.org,
	perex@perex.cz, tiwai@suse.com,
	amadeuszx.slawinski@linux.intel.com,
	sakari.ailus@linux.intel.com, khalid@kernel.org,
	shuah@kernel.org, david.hunter.linux@gmail.com,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, hariconscious@gmail.com
Subject: Re: [PATCH v2] ASoC: Intel: avs: Fix potential buffer overflow by snprintf()
Date: Thu, 13 Nov 2025 08:24:14 -0500	[thread overview]
Message-ID: <2025111313-submerge-strength-ada6@gregkh> (raw)
In-Reply-To: <bc479d42-af01-466f-b066-1da9a99b29bb@intel.com>

On Thu, Nov 13, 2025 at 09:46:12AM +0100, Cezary Rojewski wrote:
> On 2025-11-12 8:20 PM, Greg KH wrote:
> > On Wed, Nov 12, 2025 at 11:48:51PM +0530, hariconscious@gmail.com wrote:
> > > From: HariKrishna Sagala <hariconscious@gmail.com>
> > > 
> > > snprintf() returns the would-be-filled size when the string overflows
> > > the given buffer size, hence using this value may result in a buffer
> > > overflow (although it's unrealistic).
> > 
> > unrealistic == impossible
> > 
> > So why make this change at all?
> 
> The problem will never occur in production-scenario given the AudioDSP
> firmware limitation - max ~10 probe-point entries so, the built string will
> be far away from 4K_SZ bytes.
> 
> If the verdict is: ignore the recommendation as the problem is unrealistic,
> I'm OK with that. Typically though I'd prefer to stick to the
> recommendations.

That's fine, but don't claim that it fixes a buffer overflow when that
is NOT what this is doing at all.

> > > This patch replaces it with a safer version, scnprintf() for papering
> > > over such a potential issue.
> > 
> > Don't "paper over", actually fix real things.
> > 
> > 
> > > Link: https://github.com/KSPP/linux/issues/105
> > > 'Fixes: 5a565ba23abe ("ASoC: Intel: avs: Probing and firmware tracing
> > > over debugfs")'
> > 
> > No, this is not a "fix".
> 
> The patch isn't worded well, that's clear.
> While the patch is an outcome of static-analysis, isn't it good to have
> 'Fixes:' to point out the offending commit regardless?

No, it is not "fixing" anything.  Please don't claim that it does.  It
is "just" a code transformation to get rid of an api that some people do
not like.

thanks,

greg k-h

      reply	other threads:[~2025-11-13 13:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 18:18 [PATCH v2] ASoC: Intel: avs: Fix potential buffer overflow by snprintf() hariconscious
2025-11-12 19:20 ` Greg KH
2025-11-12 19:33   ` Mark Brown
2025-11-13  6:31     ` Sakari Ailus
2025-11-13  8:46   ` Cezary Rojewski
2025-11-13 13:24     ` Greg KH [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=2025111313-submerge-strength-ada6@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=david.hunter.linux@gmail.com \
    --cc=hariconscious@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=khalid@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.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