From 016f14444554ac34f0615121e09a38fe5546786e Mon Sep 17 00:00:00 2001 From: Anirudh Raghavendra Date: Thu, 9 Jul 2020 14:11:06 -0700 Subject: [PATCH] msm:adsprpc: Fixed NULL dereference in getargs() Fixed possible NULL dereference issue in getargs() Change-Id: Ia413e2c680bf890e8c4119981b94875146ce4b4e Signed-off-by: Anirudh Raghavendra --- drivers/char/adsprpc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 5527ecb263f5..3293b2de9b9a 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -2292,10 +2292,12 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) } } PERF_END); - for (i = bufs; rpra && i < bufs + handles; i++) { + + for (i = bufs; ctx->fds && rpra && i < bufs + handles; i++) { rpra[i].dma.fd = ctx->fds[i]; rpra[i].dma.len = (uint32_t)lpra[i].buf.len; - rpra[i].dma.offset = (uint32_t)(uintptr_t)lpra[i].buf.pv; + rpra[i].dma.offset = + (uint32_t)(uintptr_t)lpra[i].buf.pv; } /* Copy rpra to local buffer */