From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Fri, 07 Apr 2017 21:08:19 +0000 Subject: [PATCH 8/9] IB/isert: Use kcalloc() in isert_alloc_rx_descriptors() Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Ahern , Doug Ledford , Erez Shitrit , Feras Daoud , Hal Rosenstock , Leon Romanovsky , Mark Bloch , Or Gerlitz , Paolo Abeni , Roi Dayan , Sagi Grimberg , Sean Hefty , Yuval Shaia , Zhu Yanjun Cc: LKML , kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org From: Markus Elfring Date: Fri, 7 Apr 2017 22:00:43 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc". * Replace the specification of a data structure by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/infiniband/ulp/isert/ib_isert.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 91cbe86b25c8..c56af6183082 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -181,8 +181,9 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) u64 dma_addr; int i, j; - isert_conn->rx_descs = kzalloc(ISERT_QP_MAX_RECV_DTOS * - sizeof(struct iser_rx_desc), GFP_KERNEL); + isert_conn->rx_descs = kcalloc(ISERT_QP_MAX_RECV_DTOS, + sizeof(*isert_conn->rx_descs), + GFP_KERNEL); if (!isert_conn->rx_descs) return -ENOMEM; -- 2.12.2