aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rdma/ipath/ipath_verbs.c
diff options
context:
space:
mode:
authorShraddha Barke <shraddha.6596@gmail.com>2015-10-09 21:03:27 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-12 20:35:21 -0700
commitbe036bbe2c16929806ab747bfe8a88f5d6dbd0e5 (patch)
tree2f1d3f1d42c2ae25aab1ef84e53d5865fc5c9e0b /drivers/staging/rdma/ipath/ipath_verbs.c
parentStaging: rdma: hfi1: Use kcalloc instead of kzalloc to allocate array (diff)
downloadlinux-dev-be036bbe2c16929806ab747bfe8a88f5d6dbd0e5.tar.xz
linux-dev-be036bbe2c16929806ab747bfe8a88f5d6dbd0e5.zip
Staging: rdma: ipath: Use kcalloc instead of kzalloc to allocate array
The advantage of kcalloc is, that will prevent integer overflows which could result from the multiplication of number of elements and size and it is also a bit nicer to read. Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rdma/ipath/ipath_verbs.c')
-rw-r--r--drivers/staging/rdma/ipath/ipath_verbs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/rdma/ipath/ipath_verbs.c b/drivers/staging/rdma/ipath/ipath_verbs.c
index 17d9dca65755..40f7f059f6b2 100644
--- a/drivers/staging/rdma/ipath/ipath_verbs.c
+++ b/drivers/staging/rdma/ipath/ipath_verbs.c
@@ -2059,7 +2059,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
* the LKEY). The remaining bits act as a generation number or tag.
*/
idev->lk_table.max = 1 << ib_ipath_lkey_table_size;
- idev->lk_table.table = kzalloc(idev->lk_table.max *
+ idev->lk_table.table = kcalloc(idev->lk_table.max,
sizeof(*idev->lk_table.table),
GFP_KERNEL);
if (idev->lk_table.table == NULL) {