treewide: Use array_size() in vzalloc()
[linux-block.git] / drivers / infiniband / ulp / ipoib / ipoib_cm.c
index 962fbcb57dc7fe3034c83d1e1cb75144aa27ca23..6535d9beb24d29675ec8c6c513909a2ee0e6332d 100644 (file)
@@ -358,7 +358,8 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i
        int ret;
        int i;
 
-       rx->rx_ring = vzalloc(ipoib_recvq_size * sizeof *rx->rx_ring);
+       rx->rx_ring = vzalloc(array_size(ipoib_recvq_size,
+                                        sizeof(*rx->rx_ring)));
        if (!rx->rx_ring)
                return -ENOMEM;
 
@@ -1145,7 +1146,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
        int ret;
 
        noio_flag = memalloc_noio_save();
-       p->tx_ring = vzalloc(ipoib_sendq_size * sizeof(*p->tx_ring));
+       p->tx_ring = vzalloc(array_size(ipoib_sendq_size, sizeof(*p->tx_ring)));
        if (!p->tx_ring) {
                memalloc_noio_restore(noio_flag);
                ret = -ENOMEM;
@@ -1570,7 +1571,8 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
                return;
        }
 
-       priv->cm.srq_ring = vzalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring);
+       priv->cm.srq_ring = vzalloc(array_size(ipoib_recvq_size,
+                                              sizeof(*priv->cm.srq_ring)));
        if (!priv->cm.srq_ring) {
                ib_destroy_srq(priv->cm.srq);
                priv->cm.srq = NULL;