mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: tegra: Fix shortname truncation warning
@ 2026-12-02 13:55 Sreeraj S Kurup
  2026-12-02 16:11 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02 13:55 UTC (permalink / raw)
  To: perex, tiwai, thierry.reding, jonathanh
  Cc: linux-sound, linux-tegra, linux-kernel, Sreeraj S Kurup

The shortname truncation check uses '>' instead of '>='.

When the source string length exactly matches the destination
buffer size, strscpy() truncates the string, but the warning
is not printed.

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

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

diff --git a/sound/hda/controllers/tegra.c b/sound/hda/controllers/tegra.c
index ae9c0d3d1afe..fb98b07725fd 100644
--- a/sound/hda/controllers/tegra.c
+++ b/sound/hda/controllers/tegra.c
@@ -390,7 +390,7 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
 	sname = of_get_property(np, "nvidia,model", NULL);
 	if (!sname)
 		sname = drv_name;
-	if (strlen(sname) > sizeof(card->shortname))
+	if (strlen(sname) >= sizeof(card->shortname))
 		dev_info(card->dev, "truncating shortname for card\n");
 	strscpy(card->shortname, sname);
 
-- 
2.55.0


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 13:55 [PATCH] ALSA: hda: tegra: Fix shortname truncation warning Sreeraj S Kurup
2026-12-02 16:11 ` 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®