Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: cix-ipbloq: Fix shortname truncation warning
@ 2026-12-02 13:22 Sreeraj S Kurup
  2026-12-02 13:28 ` sashiko-bot
  2026-12-02 13:40 ` [PATCH v2] " Sreeraj S Kurup
  0 siblings, 2 replies; 3+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02 13:22 UTC (permalink / raw)
  To: cix-kernel-upstream, fugang.duan, gary.yang, perex, tiwai
  Cc: linux-arm-kernel, linux-kernel, linux-sound, 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/cix-ipbloq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/hda/controllers/cix-ipbloq.c b/sound/hda/controllers/cix-ipbloq.c
index f73d6216bce3..2deaba95591f 100644
--- a/sound/hda/controllers/cix-ipbloq.c
+++ b/sound/hda/controllers/cix-ipbloq.c
@@ -163,7 +163,7 @@ static int cix_ipbloq_hda_init(struct cix_ipbloq_hda *hda,
 	sname = of_get_property(pdev->dev.of_node, "model", NULL);
 	if (!sname)
 		sname = drv_name;
-	if (strlen(sname) > sizeof(card->shortname))
+	if (strlen(sname) >= sizeof(card->shortname))
 		dev_dbg(card->dev, "truncating shortname for card\n");
 	strscpy(card->shortname, sname, sizeof(card->shortname));
 
-- 
2.55.0


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 13:22 [PATCH] ALSA: hda: cix-ipbloq: Fix shortname truncation warning Sreeraj S Kurup
2026-12-02 13:28 ` sashiko-bot
2026-12-02 13:40 ` [PATCH v2] " Sreeraj S Kurup

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