mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: aoa: size the codec reference property name buffer
@ 2026-11-13 10:30 Aibing Chen
  2026-11-16 11:31 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Aibing Chen @ 2026-11-13 10:30 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Jaroslav Kysela, Takashi Iwai, linuxppc-dev, linux-sound, linux-kernel

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 <chenaibing@cmss.chinamobile.com>
---
 sound/aoa/fabrics/layout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index 7bb541577..8ee66dabd 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -771,7 +771,7 @@ static int check_codec(struct aoa_codec *codec,
 		       struct codec_connect_info *cci)
 {
 	const u32 *ref;
-	char propname[32];
+	char propname[MAX_CODEC_NAME_LEN + 20];
 	const struct codec_connection *cc;
 
 	/* if the codec has a 'codec' node, we require a reference */



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-16 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13 10:30 [PATCH] ALSA: aoa: size the codec reference property name buffer Aibing Chen
2026-11-16 11:31 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®