mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 08:04:24 -04:00
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>
This commit is contained in:
committed by
Saeed Mahameed
parent
e87636117e
commit
acad70731e
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user