summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@dev.mellanox.com>2013-06-25 13:09:38 +0400
committerDavid S. Miller <davem@davemloft.net>2013-06-26 03:29:39 +0400
commit30e514a71753ac3fd0ddea1411d5602ccbe14acf (patch)
tree2c1c36a3eca88087efaeee18c8321051dd9e4d8e /drivers/net/ethernet/mellanox
parent674925edb466b027d7c61993ebe3250fb8989ee0 (diff)
downloadlinux-30e514a71753ac3fd0ddea1411d5602ccbe14acf.tar.xz
net/mlx4_core: Fail device init if num_vfs is negative
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>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 81e4529092a3..56160a2bb57b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -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.
*/