From 9455a2b9dc09f39e19f6436cfcf0fa15249a09c6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 9 Nov 2015 20:09:14 +0000 Subject: [PATCH] isert-scst: Use kmalloc_array() instead of kmalloc() with multiply git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6636 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser_buf.c | 4 ++-- iscsi-scst/kernel/isert-scst/iser_pdu.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser_buf.c b/iscsi-scst/kernel/isert-scst/iser_buf.c index 9d6488760..daa78c72a 100644 --- a/iscsi-scst/kernel/isert-scst/iser_buf.c +++ b/iscsi-scst/kernel/isert-scst/iser_buf.c @@ -49,8 +49,8 @@ static int isert_buf_alloc_pg(struct ib_device *ib_dev, struct page *page; isert_buf->sg_cnt = DIV_ROUND_UP(size, PAGE_SIZE); - isert_buf->sg = kmalloc(sizeof(*isert_buf->sg) * isert_buf->sg_cnt, - GFP_KERNEL); + isert_buf->sg = kmalloc_array(isert_buf->sg_cnt, sizeof(*isert_buf->sg), + GFP_KERNEL); if (unlikely(!isert_buf->sg)) { pr_err("Failed to allocate buffer SG\n"); res = -ENOMEM; diff --git a/iscsi-scst/kernel/isert-scst/iser_pdu.c b/iscsi-scst/kernel/isert-scst/iser_pdu.c index b2b490f17..0c6e81b32 100644 --- a/iscsi-scst/kernel/isert-scst/iser_pdu.c +++ b/iscsi-scst/kernel/isert-scst/iser_pdu.c @@ -175,14 +175,14 @@ static int isert_alloc_for_rdma(struct isert_cmnd *pdu, int sge_cnt, int i, ret = 0; int wr_cnt; - sg_pool = kmalloc(sizeof(*sg_pool) * sge_cnt, GFP_KERNEL); + sg_pool = kmalloc_array(sge_cnt, sizeof(*sg_pool), GFP_KERNEL); if (unlikely(sg_pool == NULL)) { ret = -ENOMEM; goto out; } wr_cnt = DIV_ROUND_UP(sge_cnt, isert_conn->max_sge); - wr = kmalloc(sizeof(*wr) * wr_cnt, GFP_KERNEL); + wr = kmalloc_array(wr_cnt, sizeof(*wr), GFP_KERNEL); if (unlikely(wr == NULL)) { ret = -ENOMEM; goto out_free_sg_pool;