From cd8a4c01a6d059b180996b87b29a8afb49622de5 Mon Sep 17 00:00:00 2001 From: Prabha Date: Mon, 13 Sep 2021 13:25:42 +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: I98ac64a4c16f44fa4fd0e09da1648b9d78d65a82 Signed-off-by: prabha --- 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 7d01041fb823..91aee2948262 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -2673,7 +2673,7 @@ static int fastrpc_init_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) goto bail;