hwmon: (peci/cputemp) Fix off-by-one in coretemp_label allocation
authorZev Weiss <zev@bewilderbeest.net>
Thu, 2 Feb 2023 02:18:25 +0000 (18:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:23 +0000 (09:34 +0100)
commit57c07e552e0dd3fb1b663d3e87ce22dcb65bd8df
treea2e3829e5f2bbf3be74bdc05590085980a9d2095
parent70a135c6d1e03c0e904497e86dec8b2041d8abeb
hwmon: (peci/cputemp) Fix off-by-one in coretemp_label allocation

commit f00093608fa790580da309bb9feb5108fbe7c331 upstream.

The find_last_bit() call produces the index of the highest-numbered
core in core_mask; because cores are numbered from zero, the number of
elements we need to allocate is one more than that.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Cc: stable@kernel.org # v5.18
Fixes: bf3608f338e9 ("hwmon: peci: Add cputemp driver")
Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>
Link: https://lore.kernel.org/r/20230202021825.21486-1-zev@bewilderbeest.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/peci/cputemp.c