Re: [PATCH net] Revert "net/mlx5: Add sensor name to temperature event message"
From: Leon Romanovsky
Date: Tue Sep 01 2026 - 06:29:21 EST
On Fri, Aug 28, 2026 at 04:55:52AM +0000, Ben Cressey wrote:
> This reverts commit 46fd50cfcc12368bed9ae5257cc3beaea5b3c193.
>
> print_sensor_names_in_bit_set() passes the sensor index from the
> temperature warning event to hwmon_get_sensor_name(), which uses it
> as an index into temp_channel_desc[]. That array is indexed by hwmon
> channel, not by sensor index: it has one entry per ASIC or platform
> sensor the device reports, plus at most one module sensor
> (module_scount is 0 or 1). Module sensors have index 64 and up, so a
> module temperature warning reads far past the end of the allocation
> and prints whatever memory follows it, up to the next NUL byte, into
> the log.
>
> The mapping from sensor index to hwmon channel cannot be made
> reliable here: the driver registers at most one module channel, while
> the event can carry bits for other ports' modules, and the bitmap in
> the existing warning already distinguishes the ASIC sensor (bit 0)
> from module sensors (bit 64 and up). Drop the name lookup rather than
> fix the mapping, as suggested in review of an earlier fix [1].
>
> Fixes: 46fd50cfcc12 ("net/mlx5: Add sensor name to temperature event message")
> Cc: stable@xxxxxxxxxxxxxxx
> Suggested-by: Leon Romanovsky <leon@xxxxxxxxxx>
> Link: https://lore.kernel.org/netdev/20260518112555.GM33515@unreal/
> Reported-by: Will Mortensen <will@xxxxxxxxxxxx>
> Closes: https://lore.kernel.org/netdev/20260512-b4-mlx5-sensor-fix-v2-1-531fee4fd7fd@xxxxxxxxxxxx/
> Link: https://lore.kernel.org/netdev/20260515-b4-mlx5-sensor-fix-v3-1-f537ce191d6c@xxxxxxxxxxxx/ [1]
> Assisted-by: LLM
> Reviewed-by: Jose Fernandez (Anthropic) <jose.fernandez@xxxxxxxxx>
> Signed-off-by: Ben Cressey <ben@xxxxxxxxxxx>
> ---
> The restored warning string intentionally lacks the trailing period
> and newline: this is a pure revert of 46fd50cfcc12, the commit that
> added them.
>
> Will - happy for you to carry this as v4 if you'd prefer.
> ---
> drivers/net/ethernet/mellanox/mlx5/core/events.c | 31 +++---------------------
> drivers/net/ethernet/mellanox/mlx5/core/hwmon.c | 5 ----
> drivers/net/ethernet/mellanox/mlx5/core/hwmon.h | 1 -
> 3 files changed, 3 insertions(+), 34 deletions(-)
>
Thanks,
Acked-by: Leon Romanovsky <leon@xxxxxxxxxx>