Skip to content

Commit bd08ee2

Browse files
committed
Merge branch 'mlxsw-fixes'
Ido Schimmel says: ==================== mlxsw: Two small fixes Patch #1 fixes a recent regression that prevents the driver from loading with old firmware versions. Patch #2 protects the driver from a NULL pointer dereference when working on top of a buggy firmware. This was never observed in an actual system, only on top of an emulator during development. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5789d04 + 63b08b1 commit bd08ee2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg,
21532153
max_ports = mlxsw_core_max_ports(mlxsw_sp->core);
21542154
local_port = mlxsw_reg_pude_local_port_get(pude_pl);
21552155

2156-
if (WARN_ON_ONCE(local_port >= max_ports))
2156+
if (WARN_ON_ONCE(!local_port || local_port >= max_ports))
21572157
return;
21582158
mlxsw_sp_port = mlxsw_sp->ports[local_port];
21592159
if (!mlxsw_sp_port)
@@ -3290,10 +3290,10 @@ mlxsw_sp_resources_rif_mac_profile_register(struct mlxsw_core *mlxsw_core)
32903290
u8 max_rif_mac_profiles;
32913291

32923292
if (!MLXSW_CORE_RES_VALID(mlxsw_core, MAX_RIF_MAC_PROFILES))
3293-
return -EIO;
3294-
3295-
max_rif_mac_profiles = MLXSW_CORE_RES_GET(mlxsw_core,
3296-
MAX_RIF_MAC_PROFILES);
3293+
max_rif_mac_profiles = 1;
3294+
else
3295+
max_rif_mac_profiles = MLXSW_CORE_RES_GET(mlxsw_core,
3296+
MAX_RIF_MAC_PROFILES);
32973297
devlink_resource_size_params_init(&size_params, max_rif_mac_profiles,
32983298
max_rif_mac_profiles, 1,
32993299
DEVLINK_RESOURCE_UNIT_ENTRY);

0 commit comments

Comments
 (0)