Re: [PATCH net] Revert "net/mlx5: Add sensor name to temperature event message"

From: Will Mortensen

Date: Sat Aug 29 2026 - 02:26:44 EST


On Thu, Aug 27, 2026 at 9:56 PM Ben Cressey <ben@xxxxxxxxxxx> wrote:
> 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].

I don't know about "cannot be made reliable here", since my patch
hopefully did make the warning reliable (although it didn't fix other
fragile assumptions about sensors in hwmon.c, which aren't fixed by
reverting either).

Anyway, thanks for picking this up and sorry for dropping it on the floor. :-)

Reviewed-by: Will Mortensen <will@xxxxxxxxxxxx>