lib/mpi: Add the return value check of kcalloc()
PATCH 1/1 lib/mpi: Add the return value check of kcalloc()
Add the return value check of kcalloc() to avoid potential NULL ptr dereference.
Signed-off-by Zizhuang Deng <[email protected]>
--- lib/mpi/mpi-mod.c | 2 ++ 1 file changed, 2 insertions(+)
lib/mpi/mpi-mod.c +2 -0
@@ -40,6 +40,8 @@ mpi_barrett_t mpi_barrett_init(MPI m, int copy)mpi_normalize (m); ctx =kcalloc (1 ,sizeof (*ctx),GFP_KERNEL ); +if (!ctx) +return NULL ;if (copy) { ctx->m =mpi_copy (m);
Signature · 1 line
2.25.1
Quoted 5 lines · Zizhuang Deng
Add the return value check of
kcalloc()to avoid potential NULL ptr dereference.Signed-off-by Zizhuang Deng <[email protected]>---
Reviewed-by Tianjia Zhang <[email protected]>
Best regards,
Tianjia
Quoted 16 lines
lib/mpi/mpi-mod.c | 2 ++ 1 file changed, 2 insertions(+)lib/mpi/mpi-mod.c +2
-0@@ -40,6 +40,8 @@ mpi_barrett_t mpi_barrett_init(MPI m, int copy)mpi_normalize (m); ctx =kcalloc (1 ,sizeof (*ctx),GFP_KERNEL ); +if (!ctx) +return NULL ;if (copy) { ctx->m =mpi_copy (m);
Herbert Xu
maintainerQuoted 7 lines · Zizhuang Deng
Add the return value check of
kcalloc()to avoid potential NULL ptr dereference.Signed-off-by Zizhuang Deng <[email protected]>--- lib/mpi/mpi-mod.c | 2 ++ 1 file changed, 2 insertions(+)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt