Merge tag 'hwmon-for-v5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

- Fix possible KASAN issue in amd_energy driver

- Avoid configuration problem in pwm-fan driver

- Fix kernel-doc warning in sbtsi_temp documentation

* tag 'hwmon-for-v5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (amd_energy) fix allocation of hwmon_channel_info config
hwmon: (pwm-fan) Ensure that calculation doesn't discard big period values
hwmon: (sbtsi_temp) Fix Documenation kernel-doc warning

+14 -3
+1 -1
Documentation/hwmon/sbtsi_temp.rst
··· 1 1 .. SPDX-License-Identifier: GPL-2.0-or-later 2 2 3 3 Kernel driver sbtsi_temp 4 - ================== 4 + ======================== 5 5 6 6 Supported hardware: 7 7
+2 -1
drivers/hwmon/amd_energy.c
··· 222 222 */ 223 223 cpus = num_present_cpus() / num_siblings; 224 224 225 - s_config = devm_kcalloc(dev, cpus + sockets, 225 + s_config = devm_kcalloc(dev, cpus + sockets + 1, 226 226 sizeof(u32), GFP_KERNEL); 227 227 if (!s_config) 228 228 return -ENOMEM; ··· 254 254 scnprintf(label_l[i], 10, "Esocket%u", (i - cpus)); 255 255 } 256 256 257 + s_config[i] = 0; 257 258 return 0; 258 259 } 259 260
+11 -1
drivers/hwmon/pwm-fan.c
··· 334 334 335 335 ctx->pwm_value = MAX_PWM; 336 336 337 - /* Set duty cycle to maximum allowed and enable PWM output */ 338 337 pwm_init_state(ctx->pwm, &state); 338 + /* 339 + * __set_pwm assumes that MAX_PWM * (period - 1) fits into an unsigned 340 + * long. Check this here to prevent the fan running at a too low 341 + * frequency. 342 + */ 343 + if (state.period > ULONG_MAX / MAX_PWM + 1) { 344 + dev_err(dev, "Configured period too big\n"); 345 + return -EINVAL; 346 + } 347 + 348 + /* Set duty cycle to maximum allowed and enable PWM output */ 339 349 state.duty_cycle = ctx->pwm->args.period - 1; 340 350 state.enabled = true; 341 351