linux-stable/drivers/thermal
Dan Carpenter 31710aedd4 thermal/core: Potential buffer overflow in thermal_build_list_of_policies()
[ Upstream commit 1bb30b20b4 ]

After printing the list of thermal governors, then this function prints
a newline character.  The problem is that "size" has not been updated
after printing the last governor.  This means that it can write one
character (the NUL terminator) beyond the end of the buffer.

Get rid of the "size" variable and just use "PAGE_SIZE - count" directly.

Fixes: 1b4f48494e ("thermal: core: group functions related to governor handling")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210916131342.GB25094@kili
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-10-06 15:05:06 +02:00
..
broadcom
int340x_thermal
qcom
samsung thermal/drivers/exynos: Fix an error code in exynos_tmu_probe() 2021-09-26 13:37:28 +02:00
st
tegra
ti-soc-thermal
armada_thermal.c
clock_cooling.c
cpu_cooling.c
da9062-thermal.c
db8500_thermal.c
devfreq_cooling.c
dove_thermal.c
fair_share.c
gov_bang_bang.c
hisi_thermal.c
imx_thermal.c
intel_bxt_pmic_thermal.c
intel_pch_thermal.c
intel_powerclamp.c
intel_quark_dts_thermal.c
intel_soc_dts_iosf.c
intel_soc_dts_iosf.h
intel_soc_dts_thermal.c
Kconfig
kirkwood_thermal.c
Makefile
max77620_thermal.c
mtk_thermal.c
of-thermal.c
power_allocator.c
qcom-spmi-temp-alarm.c
qoriq_thermal.c
rcar_gen3_thermal.c
rcar_thermal.c
rockchip_thermal.c
spear_thermal.c
step_wise.c
tango_thermal.c
thermal-generic-adc.c
thermal_core.c thermal/core: Potential buffer overflow in thermal_build_list_of_policies() 2021-10-06 15:05:06 +02:00
thermal_core.h
thermal_helpers.c
thermal_hwmon.c
thermal_hwmon.h
thermal_sysfs.c
uniphier_thermal.c
user_space.c
x86_pkg_temp_thermal.c
zx2967_thermal.c