Re: [PATCH v4] ALSA: hda/tas2781: Add speaker id check for ASUS projects
From: Andy Shevchenko
Date: Wed Nov 13 2024 - 13:56:37 EST
On Wed, Nov 13, 2024 at 02:01:51PM +0100, Takashi Iwai wrote:
> On Mon, 04 Nov 2024 10:31:38 +0100,
> Baojun Xu wrote:
> > + // Speaker id was needed for ASUS projects.
> > + if (!strncmp(sub, TAS2781_ASUS_ID, sizeof(TAS2781_ASUS_ID))) {
>
> Is this really correct? The sizeof(TAS2781_ASUS_ID) is 5, including
> the terminating NUL. So this becomes equivalent with strcmp(), and
> it doesn't check the sub-string.
It all depends to what that method returns. If it returns the exact string
then strcmp() is fine, if not, we should understand what it returns then.
--
With Best Regards,
Andy Shevchenko