[PATCH] ALSA: hda: tegra: Fix shortname truncation warning
From: Sreeraj S Kurup
Date: Wed Dec 02 2026 - 08:56:25 EST
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@xxxxxxxxx>
---
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