Re: [PATCH] staging: greybus: audio: add size enforcement to name prefix in topology
From: Dan Carpenter
Date: Wed Nov 18 2026 - 04:00:35 EST
On Tue, Nov 17, 2026 at 08:44:33PM -0700, Garrett Floyd wrote:
> Copied name for certain functions can be 32 bytes, but destination is
> also only 32 bytes. After adding prefix, name may be truncated, causing
> compiler warning from -Wformat-truncation.
>
> drivers/staging/greybus/audio_topology.c: In function ‘gbaudio_tplg_process_kcontrols’:
> drivers/staging/greybus/audio_topology.c:1172:65: warning: ‘%s’ directive output may be truncated writing up to 31 bytes into a region of size between 17 and 27 [-Wformat-truncation=]
> drivers/staging/greybus/audio_topology.c: In function ‘gbaudio_tplg_create_widget’:
> drivers/staging/greybus/audio_topology.c:1090:51: warning: ‘%s’ directive output may be truncated writing up to 31 bytes into a region of size between 17 and 27 [-Wformat-truncation=]
Just ignore this warning. It's stupid.
We're using snprintf() as a belt and suspenders approach to preventing
buffer overflows. If it gets truncated that's fine. Great even.
The fix is to disable stupid warnings from W=1.
regards,
dan carpenter