Re: [PATCH v2] ALSA: hda/tas2781: Add speaker id check for ASUS projects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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




[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux