]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: thermal: Fix null dereference of NULL temperature parameter
authorColin Ian King <colin.king@canonical.com>
Wed, 9 Jun 2021 17:56:57 +0000 (18:56 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jun 2021 22:39:14 +0000 (15:39 -0700)
commit78a5bbadf221f64c867eb47b0570f11455d17255
treeaa478dd9d5670b39b3b27b7d9b31485cd129c0e5
parent6febee776dcd43e73a0225b25e7c8628e0432c7a
mlxsw: thermal: Fix null dereference of NULL temperature parameter

The call to mlxsw_thermal_module_temp_and_thresholds_get passes a NULL
pointer for the temperature and this can be dereferenced in this function
if the mlxsw_reg_query call fails.  The simplist fix is to pass the
address of dummy temperature variable instead of a NULL pointer.

Addresses-Coverity: ("Explicit null dereferenced")
Fixes: 957509338960 ("mlxsw: thermal: Read module temperature thresholds using MTMP register")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c