summaryrefslogtreecommitdiff
path: root/drivers/hwmon/amd_energy.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-01-09 11:22:30 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-01-09 11:22:30 -0800
commit2ff90100ace886895e4fbb2850b8d5e49d931ed6 (patch)
tree1cba26aff578c8c8c8e73d999a49b43c1b4bae9c /drivers/hwmon/amd_energy.c
parentf408126be7dc642102224cdb55d6533519a67c19 (diff)
parent84e261553e6f919bf0b4d65244599ab2b41f1da5 (diff)
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
Diffstat (limited to 'drivers/hwmon/amd_energy.c')
-rw-r--r--drivers/hwmon/amd_energy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c
index 9b306448b7a0..822c2e74b98d 100644
--- a/drivers/hwmon/amd_energy.c
+++ b/drivers/hwmon/amd_energy.c
@@ -222,7 +222,7 @@ static int amd_create_sensor(struct device *dev,
*/
cpus = num_present_cpus() / num_siblings;
- s_config = devm_kcalloc(dev, cpus + sockets,
+ s_config = devm_kcalloc(dev, cpus + sockets + 1,
sizeof(u32), GFP_KERNEL);
if (!s_config)
return -ENOMEM;
@@ -254,6 +254,7 @@ static int amd_create_sensor(struct device *dev,
scnprintf(label_l[i], 10, "Esocket%u", (i - cpus));
}
+ s_config[i] = 0;
return 0;
}