[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8734kpkjns.wl-tiwai@suse.de>
Date: Mon, 21 Oct 2024 09:19:19 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Baojun Xu <baojun.xu@...com>,
tiwai@...e.de,
robh+dt@...nel.org,
lgirdwood@...il.com,
perex@...ex.cz,
pierre-louis.bossart@...ux.intel.com,
shenghao-ding@...com,
navada@...com,
13916275206@....com,
v-hampiholi@...com,
v-po@...com,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org,
liam.r.girdwood@...el.com,
yung-chuan.liao@...ux.intel.com,
broonie@...nel.org,
antheas.dk@...il.com
Subject: Re: [PATCH v2] ALSA: hda/tas2781: Add speaker id check for ASUS projects
On Fri, 18 Oct 2024 14:31:05 +0200,
Andy Shevchenko wrote:
>
> On Fri, Oct 18, 2024 at 03:11:18PM +0800, Baojun Xu wrote:
> > + // Speaker id is not valid, use default.
> > + dev_dbg(tas_priv->dev, "Wrong spk_id = %d\n", spk_id);
> > + spk_id = 0;
> > + }
> > + scnprintf(tas_priv->coef_binaryname,
>
> Why 'c' variant? You do not check the return value anyway. So, what's the point?
There is a difference between snprintf() and scnprintf().
With W=1, the compiler (at least the recent gcc version) will warn you
when the string truncation may happen in the former case while not
complaining for the latter.
So, when the truncation is intentional and acceptable (that's
certainly most cases), the use of scnprintf() will result in less
warnings.
Takashi
Powered by blists - more mailing lists