The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Fix shortname truncation warning
@ 2026-12-02  8:39 Sreeraj S Kurup
  2026-12-02 16:09 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02  8:39 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-kernel, linux-sound, Sreeraj S Kurup

The shortname truncation check uses '>' instead of '>='.
As a result, the warning is skipped when the source string
length exactly matches the destination buffer size.

Use '>=' to correctly detect this truncation case.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 sound/hda/controllers/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/hda/controllers/acpi.c b/sound/hda/controllers/acpi.c
index 8ec7728ae81e..957577bb6566 100644
--- a/sound/hda/controllers/acpi.c
+++ b/sound/hda/controllers/acpi.c
@@ -136,7 +136,7 @@ static int hda_acpi_init(struct hda_acpi *hda)
 
 	sname = hda->data->short_name ? hda->data->short_name : KBUILD_MODNAME;
 
-	if (strlen(sname) > sizeof(card->shortname))
+	if (strlen(sname) >= sizeof(card->shortname))
 		dev_info(dev, "truncating shortname for card %s\n", sname);
 	strscpy(card->shortname, sname);
 
-- 
2.55.0


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

end of thread, other threads:[~2026-12-02 16:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  8:39 [PATCH] ALSA: hda: Fix shortname truncation warning Sreeraj S Kurup
2026-12-02 16:09 ` Takashi Iwai

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