summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBodong Wang <bodong@mellanox.com>2019-02-17 22:23:16 -0600
committerSaeed Mahameed <saeedm@mellanox.com>2019-02-19 14:15:04 -0800
commitacad70731e63aa3a901bc04a81a4a152cadbe9bf (patch)
treee2fbf11a2d9badc9a8eaa86ad8d797e4a8486d48
parente87636117e9a093ae221c1b935bf1a698be50df0 (diff)
net/mlx5: E-Switch, Fix the warning on vport index out of range
When eswitch gets vport data structure, the index should not be out of the range of the vport array. Driver mistakenly used vport number to check the range. Fixes: 22b8ddc86bf4 ("net/mlx5: E-Switch, Assign a different position for uplink rep and vport") Signed-off-by: Bodong Wang <bodong@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index e18af31336e6..d4f6859bf58c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -87,7 +87,7 @@ static struct mlx5_vport *mlx5_eswitch_get_vport(struct mlx5_eswitch *esw,
{
u16 idx = mlx5_eswitch_vport_num_to_index(esw, vport_num);
- WARN_ON(vport_num > esw->total_vports - 1);
+ WARN_ON(idx > esw->total_vports - 1);
return &esw->vports[idx];
}