mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 08:46:49 +07:00
net/mlxfw: Verify FSM error code translation doesn't exceed array size
Array mlxfw_fsm_state_err_str contains value to string translation, when
values are provided by mlxfw_dev. If value is larger than
MLXFW_FSM_STATE_ERR_MAX, return "unknown error" as expected instead of
reading an address than exceed array size.
Fixes: 410ed13cae
("Add the mlxfw module for Mellanox firmware flash process")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
b7eca94032
commit
30e9e0550b
@ -66,6 +66,8 @@ static int mlxfw_fsm_state_wait(struct mlxfw_dev *mlxfw_dev, u32 fwhandle,
|
||||
return err;
|
||||
|
||||
if (fsm_state_err != MLXFW_FSM_STATE_ERR_OK) {
|
||||
fsm_state_err = min_t(enum mlxfw_fsm_state_err,
|
||||
fsm_state_err, MLXFW_FSM_STATE_ERR_MAX);
|
||||
pr_err("Firmware flash failed: %s\n",
|
||||
mlxfw_fsm_state_err_str[fsm_state_err]);
|
||||
NL_SET_ERR_MSG_MOD(extack, "Firmware flash failed");
|
||||
|
Loading…
Reference in New Issue
Block a user