[PATCH 0/3] hwmon: (occ) Fix bugs in power sensor, extended sensor, and remove path
From: Pradhan, Sanman
Date: Thu Mar 26 2026 - 19:14:00 EST
From: Sanman Pradhan <psanman@xxxxxxxxxxx>
This series addresses three bugs in the OCC hwmon driver
(drivers/hwmon/occ/):
Patch 1 fixes a possible division by zero in occ_show_power_1()
when update_tag is zero. The power_sensor_1 code path divides the
accumulator by update_tag without checking for zero.
Commit 211186cae14d ("hwmon: (occ) Fix division by zero issue")
addressed this for occ_get_powr_avg() used by power_sensor_2
and power_sensor_a0, but the separate code path in occ_show_power_1()
was not covered. The fix reuses the existing occ_get_powr_avg()
helper which already handles the zero-sample case.
Patch 2 adds a missing trailing newline in occ_show_extended() for
the EXTN_FLAG_SENSOR_ID case.
Patch 3 reorders operations in p9_sbe_occ_remove() so that
occ_shutdown() is called before setting ctx->sbe to NULL. The
current order creates a window where a concurrent sysfs read
could see a NULL sbe pointer before the hwmon device is
unregistered.
Sanman Pradhan (3):
hwmon: (occ) Fix division by zero in occ_show_power_1()
hwmon: (occ) Fix missing newline in occ_show_extended()
hwmon: (occ) Fix potential NULL dereference in p9_sbe_occ_remove()
drivers/hwmon/occ/common.c | 20 ++++++++++----------
drivers/hwmon/occ/p9_sbe.c | 2 +-
2 files changed, 11 insertions(+), 11 deletions(-)
--
2.34.1