net/mlxfw: Verify FSM error code translation doesn't exceed array size
authorEran Ben Elisha <eranbe@mellanox.com>
Sun, 17 Nov 2019 08:18:59 +0000 (10:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:13:10 +0000 (09:13 +0100)
commita87cd32dd7007739681b6677ba70bef00b88a872
treeb22855a8d6d36692b9381db935627875f18c09dc
parent058fcda9e025ca3463645688e9091159d0926993
net/mlxfw: Verify FSM error code translation doesn't exceed array size

[ Upstream commit 30e9e0550bf693c94bc15827781fe42dd60be634 ]

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: 410ed13cae39 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c