mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user