ASoC: SOF: debug: Fix a potential issue on string buffer termination
Subsystems (3)
PATCH v2 1/1 ASoC: SOF: debug: Fix a potential issue on string buffer termination
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.
--- sound/soc/sof/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/debug.c +1 -1
@@ -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 ;
Signature · 1 line
2.25.1
Quoted 20 lines · Hui Wang
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 functiontokenize_input()indebug.cand the functionsof_dfsentry_trace_filter_write()intrace.c.Fixes 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries forIPC flood test")
Reviewed-by Kai Vehmanen <[email protected]>Signed-off-by Hui Wang <[email protected]>--- sound/soc/sof/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/sof/debug.c +0
-0
sound/soc/sof/debug.c static ssize_t sof_dfsentry_write(struct file · line 358
Quoted 8 lines
sound/soc/sof/debug.c +1
-1@@ -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.
Mark Brown
maintainerQuoted 4 lines · Hui Wang
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 functiontokenize_input()indebug.cand the functionsof_dfsentry_trace_filter_write()intrace.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