Skip to content

Commit 30e514a

Browse files
Jack Morgensteindavem330
authored andcommitted
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>
1 parent 674925e commit 30e514a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx4

‎drivers/net/ethernet/mellanox/mlx4/main.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data)
20772077
num_vfs, MLX4_MAX_NUM_VF);
20782078
return -EINVAL;
20792079
}
2080+
2081+
if (num_vfs < 0) {
2082+
pr_err("num_vfs module parameter cannot be negative\n");
2083+
return -EINVAL;
2084+
}
20802085
/*
20812086
* Check for BARs.
20822087
*/

0 commit comments

Comments
 (0)