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;