Re: [PATCH] ALSA: aoa: size the codec reference property name buffer

From
Takashi Iwai <hidden>
Date
2026-11-16 11:31:25
Also in
linux-sound, lkml
Reply to
Aibing Chen, 2026-11-13
On Fri, 13 Nov 2026 11:30:06 +0100,
Aibing Chen wrote:
check_codec() builds the device tree property name
"platform-<codec>-codec-ref" in a 32 byte buffer with snprintf().
A codec name may be up to MAX_CODEC_NAME_LEN - 1 (31) characters and
the surrounding text adds 19 characters, so the full name can be 50
characters plus the terminator.  Codec names longer than 12 characters
are silently truncated, of_get_property() then looks up a property name
that does not exist, and check_codec() fails the codec with "required
property ... not present".

All codecs in the tree use shorter names today, but the buffer should
match the documented maximum.  Size it from MAX_CODEC_NAME_LEN, which
is already available through "../aoa.h".

Compiling with W=1 before this change reports:

  sound/aoa/fabrics/layout.c:780:36: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 23 [-Wformat-truncation=]

Signed-off-by: Aibing Chen <redacted>
Is the string really truncated unexpectedly?

Otherwise it's just an incorrect compiler warning, and extending the
size doesn't make sense.


thanks,

Takashi
Thread (2 messages) 2 messages, 2 authors, last reply 9h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help