net/mlx4_core: Fix access to uninitialized index
[pandora-kernel.git] / drivers / net / ethernet / mellanox / mlx4 / mcg.c
index 978688c..f815ecd 100644 (file)
@@ -615,7 +615,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
        struct mlx4_mgm *mgm;
        u32 members_count;
        u16 hash;
-       int index, prev;
+       int index = -1, prev;
        int link = 0;
        int i;
        int err;
@@ -693,7 +693,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
                goto out;
 
 out:
-       if (prot == MLX4_PROT_ETH) {
+       if (prot == MLX4_PROT_ETH && index != -1) {
                /* manage the steering entry for promisc mode */
                if (new_entry)
                        new_steering_entry(dev, 0, port, steer, index, qp->qpn);