net/mlx4_core: Fail device init if num_vfs is negative
authorJack Morgenstein <jackm@dev.mellanox.com>
Tue, 25 Jun 2013 09:09:38 +0000 (12:09 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jun 2013 23:29:39 +0000 (16:29 -0700)
Should not allow negative num_vfs

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.com>
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/main.c

index 81e4529..56160a2 100644 (file)
@@ -2077,6 +2077,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data)
                       num_vfs, MLX4_MAX_NUM_VF);
                return -EINVAL;
        }
+
+       if (num_vfs < 0) {
+               pr_err("num_vfs module parameter cannot be negative\n");
+               return -EINVAL;
+       }
        /*
         * Check for BARs.
         */