Commit fb1dc957 authored by Cristina Moraru's avatar Cristina Moraru Committed by Greg Kroah-Hartman
Browse files

staging: rdma: Replace kmalloc with kmalloc_array



Replace kmalloc with specialized function kmalloc_array
when the size is a multiplication of:
	number_of_elements * size_of_element

Signed-off-by: default avatarCristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df5ddcc9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ static struct ib_mr *c2_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
	shift = ffs(c2mr->umem->page_size) - 1;
	n = c2mr->umem->nmap;

	pages = kmalloc(n * sizeof(u64), GFP_KERNEL);
	pages = kmalloc_array(n, sizeof(u64), GFP_KERNEL);
	if (!pages) {
		err = -ENOMEM;
		goto err;
+2 −2
Original line number Diff line number Diff line
@@ -2025,7 +2025,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
	dev = &idev->ibdev;

	if (dd->ipath_sdma_descq_cnt) {
		tx = kmalloc(dd->ipath_sdma_descq_cnt * sizeof *tx,
		tx = kmalloc_array(dd->ipath_sdma_descq_cnt, sizeof *tx,
				   GFP_KERNEL);
		if (tx == NULL) {
			ret = -ENOMEM;