From 4d5a6020f9fc49c83e7808a63a2a8088225cde81 Mon Sep 17 00:00:00 2001 From: Jeya R Date: Fri, 9 Apr 2021 13:22:31 +0530 Subject: [PATCH] msm: adsprpc: Allocate buffer taking NULL byte into consideration When attaching to audiopd on ADSP, allocate one extra byte for the process name so that it is null terminated when data is copied from file pointer in the userspace. Change-Id: Iffb9ef5cb0198ff7cbf44d0f3be03a1c9f29a90f Acked-by: Vishnu Karthik D Signed-off-by: Jeya R --- drivers/char/adsprpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 613c066ca3d2..b69595a3a587 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -3758,7 +3758,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl, if (!init->filelen) goto bail; - proc_name = kzalloc(init->filelen, GFP_KERNEL); + proc_name = kzalloc(init->filelen + 1, GFP_KERNEL); VERIFY(err, !IS_ERR_OR_NULL(proc_name)); if (err) { err = -ENOMEM;