Skip to content

Commit 299d6e4

Browse files
committed
Merge tag 'thermal-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux
Pull thermal fixes from Daniel Lezcano: - Fix thermal shutdown after a suspend/resume due to a wrong TCC value restored on Intel platform (Antoine Tenart) - Fix potential buffer overflow when building the list of policies. The buffer size is not updated after writing to it (Dan Carpenter) - Fix wrong check against IS_ERR instead of NULL (Ansuel Smith) * tag 'thermal-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux: thermal/drivers/tsens: Fix wrong check for tzd in irq handlers thermal/core: Potential buffer overflow in thermal_build_list_of_policies() thermal/drivers/int340x: Do not set a wrong tcc offset on resume
2 parents 5bb7b21 + cf96921 commit 299d6e4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int tcc_offset_update(unsigned int tcc)
107107
return 0;
108108
}
109109

110-
static unsigned int tcc_offset_save;
110+
static int tcc_offset_save = -1;
111111

112112
static ssize_t tcc_offset_degree_celsius_store(struct device *dev,
113113
struct device_attribute *attr, const char *buf,
@@ -352,7 +352,8 @@ int proc_thermal_resume(struct device *dev)
352352
proc_dev = dev_get_drvdata(dev);
353353
proc_thermal_read_ppcc(proc_dev);
354354

355-
tcc_offset_update(tcc_offset_save);
355+
if (tcc_offset_save >= 0)
356+
tcc_offset_update(tcc_offset_save);
356357

357358
return 0;
358359
}

drivers/thermal/qcom/tsens.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static irqreturn_t tsens_critical_irq_thread(int irq, void *data)
417417
const struct tsens_sensor *s = &priv->sensor[i];
418418
u32 hw_id = s->hw_id;
419419

420-
if (IS_ERR(s->tzd))
420+
if (!s->tzd)
421421
continue;
422422
if (!tsens_threshold_violated(priv, hw_id, &d))
423423
continue;
@@ -467,7 +467,7 @@ static irqreturn_t tsens_irq_thread(int irq, void *data)
467467
const struct tsens_sensor *s = &priv->sensor[i];
468468
u32 hw_id = s->hw_id;
469469

470-
if (IS_ERR(s->tzd))
470+
if (!s->tzd)
471471
continue;
472472
if (!tsens_threshold_violated(priv, hw_id, &d))
473473
continue;

drivers/thermal/thermal_core.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,14 @@ int thermal_build_list_of_policies(char *buf)
222222
{
223223
struct thermal_governor *pos;
224224
ssize_t count = 0;
225-
ssize_t size = PAGE_SIZE;
226225

227226
mutex_lock(&thermal_governor_lock);
228227

229228
list_for_each_entry(pos, &thermal_governor_list, governor_list) {
230-
size = PAGE_SIZE - count;
231-
count += scnprintf(buf + count, size, "%s ", pos->name);
229+
count += scnprintf(buf + count, PAGE_SIZE - count, "%s ",
230+
pos->name);
232231
}
233-
count += scnprintf(buf + count, size, "\n");
232+
count += scnprintf(buf + count, PAGE_SIZE - count, "\n");
234233

235234
mutex_unlock(&thermal_governor_lock);
236235

0 commit comments

Comments
 (0)