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

* Re: [PATCH] ALSA: hda: cix-ipbloq: Fix shortname truncation warning
  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
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-02 13:28 UTC (permalink / raw)
  To: Sreeraj S Kurup; +Cc: linux-sound

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ALSA: hda: cix-ipbloq: missing Fixes trailer for
  cix_ipbloq_hda_init() fix
--

commit 06df60c32a7943b308849faac449633659db5056
Author: Sreeraj S Kurup <sreekuttan2156239@gmail.com>

> ALSA: hda: cix-ipbloq: Fix shortname truncation warning
>
> 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>

[Severity: Low]
Since this fixes the off-by-one truncation check in cix_ipbloq_hda_init(),
should the commit message include a Fixes tag?

  Fixes: d91e9bd10125 ("ALSA: hda: add CIX IPBLOQ HDA controller support")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202132227.2781-1-sreekuttan2156239@gmail.com?part=1

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

* [PATCH v2] ALSA: hda: cix-ipbloq: Fix shortname truncation warning
  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 ` Sreeraj S Kurup
  1 sibling, 0 replies; 3+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02 13:40 UTC (permalink / raw)
  To: sreekuttan2156239, cix-kernel-upstream, fugang.duan, gary.yang,
	perex, tiwai
  Cc: linux-arm-kernel, linux-kernel, linux-sound

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.

Fixes: d91e9bd10125 ("ALSA: hda: add CIX IPBLOQ HDA controller support")
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
v2:
 - Add Fixes trailer.

 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