LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aibing Chen <chenaibing@cmss.chinamobile.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linuxppc-dev@lists.ozlabs.org, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ALSA: aoa: size the codec reference property name buffer
Date: Fri, 13 Nov 2026 18:30:06 +0800	[thread overview]
Message-ID: <20261113103006.705-1-chenaibing@cmss.chinamobile.com> (raw)

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 */




             reply	other threads:[~2026-11-13 23:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 10:30 Aibing Chen [this message]
2026-11-16 11:31 ` [PATCH] ALSA: aoa: size the codec reference property name buffer Takashi Iwai
2026-11-23  3:27   ` Aibing Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113103006.705-1-chenaibing@cmss.chinamobile.com \
    --to=chenaibing@cmss.chinamobile.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox