* [PATCH] ASoC: wm_adsp: Use scnprintf() for the limited buffer output
@ 2020-03-13 13:03 Takashi Iwai
2020-03-13 13:25 ` Charles Keepax
2020-03-13 14:50 ` Applied "ASoC: wm_adsp: Use scnprintf() for the limited buffer output" to the asoc tree Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Takashi Iwai @ 2020-03-13 13:03 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Charles Keepax
snprintf() is a hard-to-use function, it's especially difficult to use
it for concatenating substrings in a buffer with a limited size.
Since snprintf() returns the would-be-output size, not the actual
size, the subsequent use of snprintf() may point to the incorrect
position.
Use scnprintf() instead for fixing such potential errors.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/soc/codecs/wm_adsp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index d3d32b501aca..ffb9836e0538 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1436,12 +1436,12 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
subname = NULL; /* don't append subname */
break;
case 2:
- ret = snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+ ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
"%s%c %.12s %x", dsp->name, *region_name,
wm_adsp_fw_text[dsp->fw], alg_region->alg);
break;
default:
- ret = snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+ ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
"%s %.12s %x", dsp->name,
wm_adsp_fw_text[dsp->fw], alg_region->alg);
break;
--
2.16.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: wm_adsp: Use scnprintf() for the limited buffer output
2020-03-13 13:03 [PATCH] ASoC: wm_adsp: Use scnprintf() for the limited buffer output Takashi Iwai
@ 2020-03-13 13:25 ` Charles Keepax
2020-03-13 14:50 ` Applied "ASoC: wm_adsp: Use scnprintf() for the limited buffer output" to the asoc tree Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2020-03-13 13:25 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Mark Brown
On Fri, Mar 13, 2020 at 02:03:34PM +0100, Takashi Iwai wrote:
> snprintf() is a hard-to-use function, it's especially difficult to use
> it for concatenating substrings in a buffer with a limited size.
> Since snprintf() returns the would-be-output size, not the actual
> size, the subsequent use of snprintf() may point to the incorrect
> position.
>
> Use scnprintf() instead for fixing such potential errors.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
* Applied "ASoC: wm_adsp: Use scnprintf() for the limited buffer output" to the asoc tree
2020-03-13 13:03 [PATCH] ASoC: wm_adsp: Use scnprintf() for the limited buffer output Takashi Iwai
2020-03-13 13:25 ` Charles Keepax
@ 2020-03-13 14:50 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-03-13 14:50 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Mark Brown, Charles Keepax
The patch
ASoC: wm_adsp: Use scnprintf() for the limited buffer output
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From 578194290d0bf85b087e73e35ea74574012cfd96 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 13 Mar 2020 14:03:34 +0100
Subject: [PATCH] ASoC: wm_adsp: Use scnprintf() for the limited buffer output
snprintf() is a hard-to-use function, it's especially difficult to use
it for concatenating substrings in a buffer with a limited size.
Since snprintf() returns the would-be-output size, not the actual
size, the subsequent use of snprintf() may point to the incorrect
position.
Use scnprintf() instead for fixing such potential errors.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200313130334.9028-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/wm_adsp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 2a9b610f6d43..9e5b6c4ac475 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1432,12 +1432,12 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
subname = NULL; /* don't append subname */
break;
case 2:
- ret = snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+ ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
"%s%c %.12s %x", dsp->name, *region_name,
wm_adsp_fw_text[dsp->fw], alg_region->alg);
break;
default:
- ret = snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
+ ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
"%s %.12s %x", dsp->name,
wm_adsp_fw_text[dsp->fw], alg_region->alg);
break;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-13 14:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 13:03 [PATCH] ASoC: wm_adsp: Use scnprintf() for the limited buffer output Takashi Iwai
2020-03-13 13:25 ` Charles Keepax
2020-03-13 14:50 ` Applied "ASoC: wm_adsp: Use scnprintf() for the limited buffer output" to the asoc tree Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.