Re: [PATCH] ALSA: asihpi: work around clang-17+ false positive fortify-string warning

From: Arnd Bergmann
Date: Wed Feb 28 2024 - 12:23:47 EST


On Wed, Feb 28, 2024, at 17:24, Takashi Iwai wrote:
> On Wed, 28 Feb 2024 16:03:56 +0100,
>> On Wed, Feb 28, 2024, at 15:37, Takashi Iwai wrote:
>> > On Wed, 28 Feb 2024 15:01:45 +0100,
>>
>> The fortified-string warning only triggers for string.h operations
>> (memset, memcpy, memcmp, strn*...), not for a direct assignment.
>
> Ah, I see. Then from the logical POV, it's better to have a check
> before that assignment; otherwise it'd overflow silently there.
>
> Does putting the check beforehand (like the one below) fix similarly?

Indeed, it does address the issue. I'll send a v2 with that
version, since it clearly makes more sense.

Arnd