treewide: kmalloc() -> kmalloc_array()
[linux-block.git] / drivers / infiniband / hw / mlx4 / main.c
index f839bf3b1497a9e1414f9016973822288067765d..4ec519afc45b780812f08ad8acb3fd35f7b16c53 100644 (file)
@@ -302,7 +302,8 @@ static int mlx4_ib_add_gid(const union ib_gid *gid,
                ctx->refcount++;
        }
        if (!ret && hw_update) {
-               gids = kmalloc(sizeof(*gids) * MLX4_MAX_PORT_GIDS, GFP_ATOMIC);
+               gids = kmalloc_array(MLX4_MAX_PORT_GIDS, sizeof(*gids),
+                                    GFP_ATOMIC);
                if (!gids) {
                        ret = -ENOMEM;
                } else {
@@ -355,7 +356,8 @@ static int mlx4_ib_del_gid(const struct ib_gid_attr *attr, void **context)
        if (!ret && hw_update) {
                int i;
 
-               gids = kmalloc(sizeof(*gids) * MLX4_MAX_PORT_GIDS, GFP_ATOMIC);
+               gids = kmalloc_array(MLX4_MAX_PORT_GIDS, sizeof(*gids),
+                                    GFP_ATOMIC);
                if (!gids) {
                        ret = -ENOMEM;
                } else {
@@ -2872,9 +2874,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
                        goto err_counter;
 
                ibdev->ib_uc_qpns_bitmap =
-                       kmalloc(BITS_TO_LONGS(ibdev->steer_qpn_count) *
-                               sizeof(long),
-                               GFP_KERNEL);
+                       kmalloc_array(BITS_TO_LONGS(ibdev->steer_qpn_count),
+                                     sizeof(long),
+                                     GFP_KERNEL);
                if (!ibdev->ib_uc_qpns_bitmap)
                        goto err_steer_qp_release;