diff options
-rw-r--r-- | drivers/infiniband/hw/hfi1/sdma.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c index 298e0e3fc0c9..7fb350b87b49 100644 --- a/drivers/infiniband/hw/hfi1/sdma.c +++ b/drivers/infiniband/hw/hfi1/sdma.c @@ -1461,7 +1461,8 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) if (!sde->descq) goto bail; sde->tx_ring = - kvzalloc_node(sizeof(struct sdma_txreq *) * descq_cnt, + kvzalloc_node(array_size(descq_cnt, + sizeof(struct sdma_txreq *)), GFP_KERNEL, dd->node); if (!sde->tx_ring) goto bail; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index d56752273d00..56c1b6f5593e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -448,7 +448,7 @@ static int mlx5e_init_di_list(struct mlx5e_rq *rq, { int len = wq_sz << rq->wqe.info.log_num_frags; - rq->wqe.di = kvzalloc_node(len * sizeof(*rq->wqe.di), + rq->wqe.di = kvzalloc_node(array_size(len, sizeof(*rq->wqe.di)), GFP_KERNEL, cpu_to_node(cpu)); if (!rq->wqe.di) return -ENOMEM; @@ -563,8 +563,8 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, rq->wqe.info = rqp->frags_info; rq->wqe.frags = - kvzalloc_node((wq_sz << rq->wqe.info.log_num_frags) * - sizeof(*rq->wqe.frags), + kvzalloc_node(array_size(sizeof(*rq->wqe.frags), + (wq_sz << rq->wqe.info.log_num_frags)), GFP_KERNEL, cpu_to_node(c->cpu)); if (!rq->wqe.frags) { err = -ENOMEM; |