Re: [PATCH v2] ASoC: SOF: debug: Fix a potential issue on string buffer termination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
> Signed-off-by: Hui Wang <hui.wang@xxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx>




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux