sound/soc/sof:Use kmalloc_array instead of kmalloc
Subsystems (3)
PATCH RESEND 1/1 sound/soc/sof:Use kmalloc_array instead of kmalloc
From: HariKrishna Sagala <[email protected]>
Documentation/process/deprecated.rst recommends to avoid the use of kmalloc with dynamic size calculations due to the risk of them overflowing. This could lead to values wrapping around and a smaller allocation being made than the caller was expecting.
Replace kmalloc() with kmalloc_array()
Signed-off-by HariKrishna Sagala <[email protected]>
---
Resending the patch
sound/soc/sof/ipc3-dtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/ipc3-dtrace.c +1 -1
@@ -126,7 +126,7 @@ static int trace_filter_parse(struct snd_sof_dev *sdev, char *string, capacity +=TRACE_FILTER_ELEMENTS_PER_ENTRY ; entry =strchr (entry +1 , entry_delimiter[0 ]); } - *out =kmalloc (capacity *sizeof (**out),GFP_KERNEL ); + *out =kmalloc_array (capacity,sizeof (**out),GFP_KERNEL );if (!*out)return -ENOMEM ;
Signature · 1 line
2.43.0