Skip to content
Snippets Groups Projects
Commit dd827abe authored by Zizhuang Deng's avatar Zizhuang Deng Committed by Herbert Xu
Browse files

lib/mpi: Add the return value check of kcalloc()


Add the return value check of kcalloc() to avoid potential
NULL ptr dereference.

Fixes: a8ea8bdd ("lib/mpi: Extend the MPI library")
Signed-off-by: default avatarZizhuang Deng <sunsetdzz@gmail.com>
Reviewed-by: default avatarTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 4cab5dfd
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,8 @@ mpi_barrett_t mpi_barrett_init(MPI m, int copy) ...@@ -40,6 +40,8 @@ mpi_barrett_t mpi_barrett_init(MPI m, int copy)
mpi_normalize(m); mpi_normalize(m);
ctx = kcalloc(1, sizeof(*ctx), GFP_KERNEL); ctx = kcalloc(1, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return NULL;
if (copy) { if (copy) {
ctx->m = mpi_copy(m); ctx->m = mpi_copy(m);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment