[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250805234156.60294-1-thorsten.blum@linux.dev>
Date: Wed, 6 Aug 2025 01:41:53 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Thorsten Blum <thorsten.blum@...ux.dev>,
Joe Perches <joe@...ches.com>,
Mark Brown <broonie@...nel.org>
Cc: stable@...r.kernel.org,
Takashi Iwai <tiwai@...e.de>,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] ALSA: intel_hdmi: Fix off-by-one error in __hdmi_lpe_audio_probe()
In __hdmi_lpe_audio_probe(), strscpy() is incorrectly called with the
length of the source string (excluding the NUL terminator) rather than
the size of the destination buffer. This results in one character less
being copied from 'card->shortname' to 'pcm->name'.
Use the destination buffer size instead to ensure the card name is
copied correctly.
Cc: stable@...r.kernel.org
Fixes: 75b1a8f9d62e ("ALSA: Convert strlcpy to strscpy when return value is unused")
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
Changes in v2:
- Use three parameter variant of strscpy() for backporting as suggested
by Sakari Ailus <sakari.ailus@...ux.intel.com>
- Link to v1: https://lore.kernel.org/lkml/20250805190809.31150-1-thorsten.blum@linux.dev/
---
sound/x86/intel_hdmi_audio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index cc54539c6030..01f49555c5f6 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1765,7 +1765,7 @@ static int __hdmi_lpe_audio_probe(struct platform_device *pdev)
/* setup private data which can be retrieved when required */
pcm->private_data = ctx;
pcm->info_flags = 0;
- strscpy(pcm->name, card->shortname, strlen(card->shortname));
+ strscpy(pcm->name, card->shortname, sizeof(pcm->name));
/* setup the ops for playback */
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &had_pcm_ops);
--
2.50.1
Powered by blists - more mailing lists