[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1620828254-25545-3-git-send-email-herbert.tencent@gmail.com>
Date: Wed, 12 May 2021 22:04:09 +0800
From: Hongbo Li <herbert.tencent@...il.com>
To: keyrings@...r.kernel.org, linux-crypto@...r.kernel.org,
herbert@...dor.apana.org.au, dhowells@...hat.com,
jarkko@...nel.org, tianjia.zhang@...ux.alibaba.com,
herberthbli@...cent.com
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 2/7] lib/mpi: use kcalloc in mpi_resize
From: Hongbo Li <herberthbli@...cent.com>
We should set the additional space to 0 in mpi_resize().
So use kcalloc() instead of kmalloc_array().
Signed-off-by: Hongbo Li <herberthbli@...cent.com>
---
lib/mpi/mpiutil.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c
index 3c63710..e6c4b31 100644
--- a/lib/mpi/mpiutil.c
+++ b/lib/mpi/mpiutil.c
@@ -148,7 +148,7 @@ int mpi_resize(MPI a, unsigned nlimbs)
return 0; /* no need to do it */
if (a->d) {
- p = kmalloc_array(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL);
+ p = kcalloc(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL);
if (!p)
return -ENOMEM;
memcpy(p, a->d, a->alloced * sizeof(mpi_limb_t));
--
1.8.3.1
Powered by blists - more mailing lists