Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'thermal-5.20-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more thermal control updates from Rafael Wysocki:
"These fix an error code path issue leading to a NULL pointer
dereference, drop Kconfig dependencies that are not needed any more
after recent changes, add CPU IDs for new chips to a driver and fix up
the tmon utility.

Specifics:

- Fix NULL pointer dereference in the thermal sysfs interface that
results from an error code path mishandling (Rafael Wysocki).

- Drop COMPILE_TEST dependency that's not needed any more from two
thermal Kconfig entries (Jean Delvare).

- Make the Intel TCC cooling driver support Alder Lake-N and Raptor
Lake-P (Sumeet Pawnikar).

- Fix possible path truncations in the tmon utility (Florian
Fainelli)"

* tag 'thermal-5.20-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
tools/thermal: Fix possible path truncations
thermal: Drop obsolete dependency on COMPILE_TEST
thermal: sysfs: Fix cooling_device_stats_setup() error code path
thermal: intel: Add TCC cooling support for Alder Lake-N and Raptor Lake-P

+24 -16
+2 -2
drivers/thermal/Kconfig
··· 221 221 222 222 config THERMAL_MMIO 223 223 tristate "Generic Thermal MMIO driver" 224 - depends on OF || COMPILE_TEST 224 + depends on OF 225 225 depends on HAS_IOMEM 226 226 help 227 227 This option enables the generic thermal MMIO driver that will use ··· 496 496 497 497 config KHADAS_MCU_FAN_THERMAL 498 498 tristate "Khadas MCU controller FAN cooling support" 499 - depends on OF || COMPILE_TEST 499 + depends on OF 500 500 depends on MFD_KHADAS_MCU 501 501 select MFD_CORE 502 502 select REGMAP
+2
drivers/thermal/intel/intel_tcc_cooling.c
··· 81 81 X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, NULL), 82 82 X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, NULL), 83 83 X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, NULL), 84 + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL), 84 85 X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL), 86 + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL), 85 87 {} 86 88 }; 87 89
+7 -3
drivers/thermal/thermal_sysfs.c
··· 813 813 814 814 static void cooling_device_stats_setup(struct thermal_cooling_device *cdev) 815 815 { 816 + const struct attribute_group *stats_attr_group = NULL; 816 817 struct cooling_dev_stats *stats; 817 818 unsigned long states; 818 819 int var; 819 820 820 821 if (cdev->ops->get_max_state(cdev, &states)) 821 - return; 822 + goto out; 822 823 823 824 states++; /* Total number of states is highest state + 1 */ 824 825 ··· 829 828 830 829 stats = kzalloc(var, GFP_KERNEL); 831 830 if (!stats) 832 - return; 831 + goto out; 833 832 834 833 stats->time_in_state = (ktime_t *)(stats + 1); 835 834 stats->trans_table = (unsigned int *)(stats->time_in_state + states); ··· 839 838 840 839 spin_lock_init(&stats->lock); 841 840 841 + stats_attr_group = &cooling_device_stats_attr_group; 842 + 843 + out: 842 844 /* Fill the empty slot left in cooling_device_attr_groups */ 843 845 var = ARRAY_SIZE(cooling_device_attr_groups) - 2; 844 - cooling_device_attr_groups[var] = &cooling_device_stats_attr_group; 846 + cooling_device_attr_groups[var] = stats_attr_group; 845 847 } 846 848 847 849 static void cooling_device_stats_destroy(struct thermal_cooling_device *cdev)
+13 -11
tools/thermal/tmon/sysfs.c
··· 13 13 #include <stdint.h> 14 14 #include <dirent.h> 15 15 #include <libintl.h> 16 + #include <limits.h> 16 17 #include <ctype.h> 17 18 #include <time.h> 18 19 #include <syslog.h> ··· 34 33 { 35 34 FILE *fd; 36 35 int ret = -1; 37 - char filepath[256]; 36 + char filepath[PATH_MAX + 2]; /* NUL and '/' */ 38 37 39 - snprintf(filepath, 256, "%s/%s", path, filename); 38 + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); 40 39 41 40 fd = fopen(filepath, "w"); 42 41 if (!fd) { ··· 58 57 { 59 58 FILE *fd; 60 59 int ret = -1; 61 - char filepath[256]; 60 + char filepath[PATH_MAX + 2]; /* NUL and '/' */ 62 61 63 - snprintf(filepath, 256, "%s/%s", path, filename); 62 + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); 64 63 65 64 fd = fopen(filepath, "r"); 66 65 if (!fd) { ··· 77 76 { 78 77 FILE *fd; 79 78 int ret = -1; 80 - char filepath[256]; 79 + char filepath[PATH_MAX + 2]; /* NUL and '/' */ 81 80 82 - snprintf(filepath, 256, "%s/%s", path, filename); 81 + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); 83 82 84 83 fd = fopen(filepath, "r"); 85 84 if (!fd) { ··· 200 199 { 201 200 unsigned long trip_instance = 0; 202 201 char cdev_name_linked[256]; 203 - char cdev_name[256]; 204 - char cdev_trip_name[256]; 202 + char cdev_name[PATH_MAX]; 203 + char cdev_trip_name[PATH_MAX]; 205 204 int cdev_id; 206 205 207 206 if (nl->d_type == DT_LNK) { ··· 214 213 return -EINVAL; 215 214 } 216 215 /* find the link to real cooling device record binding */ 217 - snprintf(cdev_name, 256, "%s/%s", tz_name, nl->d_name); 216 + snprintf(cdev_name, sizeof(cdev_name) - 2, "%s/%s", 217 + tz_name, nl->d_name); 218 218 memset(cdev_name_linked, 0, sizeof(cdev_name_linked)); 219 219 if (readlink(cdev_name, cdev_name_linked, 220 220 sizeof(cdev_name_linked) - 1) != -1) { ··· 228 226 /* find the trip point in which the cdev is binded to 229 227 * in this tzone 230 228 */ 231 - snprintf(cdev_trip_name, 256, "%s%s", nl->d_name, 232 - "_trip_point"); 229 + snprintf(cdev_trip_name, sizeof(cdev_trip_name) - 1, 230 + "%s%s", nl->d_name, "_trip_point"); 233 231 sysfs_get_ulong(tz_name, cdev_trip_name, 234 232 &trip_instance); 235 233 /* validate trip point range, e.g. trip could return -1