alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: SOF: debug: Fix a potential issue on string buffer termination
@ 2021-02-08 10:38 Hui Wang
  2021-02-08 17:00 ` Ranjani Sridharan
  2021-02-08 18:38 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Hui Wang @ 2021-02-08 10:38 UTC (permalink / raw)
  To: alsa-devel, pierre-louis.bossart, ranjani.sridharan,
	kai.vehmanen, broonie

The function simple_write_to_buffer() doesn't add string termination
at the end of buf, we need to handle it on our own. This change refers
to the function tokenize_input() in debug.c and the function
sof_dfsentry_trace_filter_write() in trace.c.

Fixes: 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries for IPC flood test")
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/soc/sof/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index 30213a1beaaa..715a374b33cf 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -352,7 +352,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
 	char *string;
 	int ret;
 
-	string = kzalloc(count, GFP_KERNEL);
+	string = kzalloc(count+1, GFP_KERNEL);
 	if (!string)
 		return -ENOMEM;
 
-- 
2.25.1


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

* Re: [PATCH v2] ASoC: SOF: debug: Fix a potential issue on string buffer termination
  2021-02-08 10:38 [PATCH v2] ASoC: SOF: debug: Fix a potential issue on string buffer termination Hui Wang
@ 2021-02-08 17:00 ` Ranjani Sridharan
  2021-02-08 18:38 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Ranjani Sridharan @ 2021-02-08 17:00 UTC (permalink / raw)
  To: Hui Wang, alsa-devel, pierre-louis.bossart, kai.vehmanen, broonie

On Mon, 2021-02-08 at 18:38 +0800, Hui Wang wrote:
> The function simple_write_to_buffer() doesn't add string termination
> at the end of buf, we need to handle it on our own. This change
> refers
> to the function tokenize_input() in debug.c and the function
> sof_dfsentry_trace_filter_write() in trace.c.
> 
> Fixes: 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries for
> IPC flood test")
> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> Signed-off-by: Hui Wang <hui.wang@canonical.com>
> ---
>  sound/soc/sof/debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
> index 30213a1beaaa..715a374b33cf 100644
> --- a/sound/soc/sof/debug.c
> +++ b/sound/soc/sof/debug.c
> @@ -352,7 +352,7 @@ static ssize_t sof_dfsentry_write(struct file
> *file, const char __user *buffer,
>  	char *string;
>  	int ret;
>  
> -	string = kzalloc(count, GFP_KERNEL);
> +	string = kzalloc(count+1, GFP_KERNEL);
>  	if (!string)
>  		return -ENOMEM;
>  
LGTM except that may be checkpatch would complain about the spaces
missing around the + sign.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>


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

* Re: [PATCH v2] ASoC: SOF: debug: Fix a potential issue on string buffer termination
  2021-02-08 10:38 [PATCH v2] ASoC: SOF: debug: Fix a potential issue on string buffer termination Hui Wang
  2021-02-08 17:00 ` Ranjani Sridharan
@ 2021-02-08 18:38 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-02-08 18:38 UTC (permalink / raw)
  To: alsa-devel, ranjani.sridharan, kai.vehmanen,
	pierre-louis.bossart, Hui Wang

On Mon, 8 Feb 2021 18:38:57 +0800, Hui Wang wrote:
> The function simple_write_to_buffer() doesn't add string termination
> at the end of buf, we need to handle it on our own. This change refers
> to the function tokenize_input() in debug.c and the function
> sof_dfsentry_trace_filter_write() in trace.c.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: debug: Fix a potential issue on string buffer termination
      commit: 9037c3bde65d339017ef41d81cb58069ffc321d4

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

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

end of thread, other threads:[~2021-02-08 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 10:38 [PATCH v2] ASoC: SOF: debug: Fix a potential issue on string buffer termination Hui Wang
2021-02-08 17:00 ` Ranjani Sridharan
2021-02-08 18:38 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).