mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
hwmon: (peci/cputemp) Fix off-by-one in cputemp_is_visible()
commitb0c9d8ae71upstream. cputemp_is_visible() validates the channel index against CPUTEMP_CHANNEL_NUMS, but currently uses '>' instead of '>='. As a result, channel == CPUTEMP_CHANNEL_NUMS is not rejected even though valid indices are 0 .. CPUTEMP_CHANNEL_NUMS - 1. Fix the bounds check by using '>=' so invalid channel indices are rejected before indexing the core bitmap. Fixes:bf3608f338("hwmon: peci: Add cputemp driver") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260323002352.93417-3-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7c0666a26b
commit
ebdd28353b
@@ -339,7 +339,7 @@ static umode_t cputemp_is_visible(const void *data, enum hwmon_sensor_types type
|
||||
{
|
||||
const struct peci_cputemp *priv = data;
|
||||
|
||||
if (channel > CPUTEMP_CHANNEL_NUMS)
|
||||
if (channel >= CPUTEMP_CHANNEL_NUMS)
|
||||
return 0;
|
||||
|
||||
if (channel < channel_core)
|
||||
|
||||
Reference in New Issue
Block a user