linux-stable/drivers/cpufreq
Christian Marangi ea167a7fc2 cpufreq: stats: Fix buffer overflow detection in trans_stats()
Commit 3c0897c180 ("cpufreq: Use scnprintf() for avoiding potential
buffer overflow") switched from snprintf to the more secure scnprintf
but never updated the exit condition for PAGE_SIZE.

As the commit say and as scnprintf document, what scnprintf returns what
is actually written not counting the '\0' end char. This results in the
case of len exceeding the size, len set to PAGE_SIZE - 1, as it can be
written at max PAGE_SIZE - 1 (as '\0' is not counted)

Because of len is never set to PAGE_SIZE, the function never break early,
never prints the warning and never return -EFBIG.

Fix this by changing the condition to PAGE_SIZE - 1 to correctly trigger
the error.

Cc: 5.10+ <stable@vger.kernel.org> # 5.10+
Fixes: 3c0897c180 ("cpufreq: Use scnprintf() for avoiding potential buffer overflow")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-10-24 22:02:06 +02:00
..
acpi-cpufreq.c cpufreq: acpi: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
amd-pstate-trace.c cpufreq: amd-pstate: Add trace for AMD P-State module 2021-12-30 18:51:39 +01:00
amd-pstate-trace.h cpufreq: amd-pstate: Add more tracepoint for AMD P-State module 2022-03-09 19:53:01 +01:00
amd-pstate-ut.c ARM cpufreq updates for 6.6 2023-08-28 14:12:05 +02:00
amd-pstate.c cpufreq: amd-pstate: fix global sysfs attribute type 2023-08-07 19:41:48 +02:00
amd_freq_sensitivity.c cpufreq: amd_freq_sensitivity: Add missing pci_dev_put() 2022-11-30 19:50:04 +01:00
apple-soc-cpufreq.c cpufreq: apple-soc: Fix an IS_ERR() vs NULL check 2023-03-01 19:34:54 +01:00
armada-8k-cpufreq.c cpufreq: armada-8k: add ap807 support 2023-06-19 09:50:31 +05:30
armada-37xx-cpufreq.c cpufreq: Explicitly include correct DT includes 2023-07-20 16:01:57 +05:30
bmips-cpufreq.c cpufreq: bmips-cpufreq: Use module_init and add module_exit 2022-08-30 13:49:23 +05:30
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug 2023-08-03 11:25:04 +05:30
cppc_cpufreq.c cpufreq: cppc: Set fie_disabled to FIE_DISABLED if fails to create kworker_fie 2023-08-17 14:24:58 +05:30
cpufreq-dt-platdev.c cpufreq: blocklist more Qualcomm platforms in cpufreq-dt-platdev 2023-08-09 10:57:18 +05:30
cpufreq-dt.c cpufreq: dt: Convert to platform remove callback returning void 2023-07-20 16:02:12 +05:30
cpufreq-dt.h
cpufreq-nforce2.c
cpufreq.c cpufreq: Rebuild sched-domains when removing cpufreq driver 2023-10-06 22:05:56 +02:00
cpufreq_conservative.c cpufreq: conservative: Simplify the condition of storing 'down_threshold' 2023-10-06 21:55:13 +02:00
cpufreq_governor.c cpufreq: governor: Free dbs_data directly when gov->init() fails 2023-08-29 20:21:35 +02:00
cpufreq_governor.h cpufreq: governor: Use kobject release() method to free dbs_data 2022-04-13 15:22:41 +02:00
cpufreq_governor_attr_set.c cpufreq: Move to_gov_attr_set() to cpufreq.h 2022-02-04 19:22:34 +01:00
cpufreq_ondemand.c cpufreq: ondemand: Use cpumask_var_t for on-stack cpu mask 2022-07-25 20:38:01 +02:00
cpufreq_ondemand.h
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c cpufreq: stats: Fix buffer overflow detection in trans_stats() 2023-10-24 22:02:06 +02:00
cpufreq_userspace.c cpufreq: userspace: Move is_managed indicator into per-policy structure 2023-10-06 22:01:26 +02:00
davinci-cpufreq.c cpufreq: davinci: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
e_powersaver.c
elanfreq.c
freq_table.c Updates for 6.4 2023-04-20 19:30:01 +02:00
gx-suspmod.c
highbank-cpufreq.c cpufreq: Add __init annotation to module init funcs 2022-09-26 11:15:04 +05:30
ia64-acpi-cpufreq.c ia64: fix format string for ia64-acpi-cpu-freq 2021-03-19 17:26:20 +01:00
imx-cpufreq-dt.c cpufreq: imx-cpufreq-dt: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
imx6q-cpufreq.c cpufreq: imx6q: Convert to platform remove callback returning void 2023-07-20 16:02:12 +05:30
intel_pstate.c cpufreq: intel_pstate: Revise global turbo disable check 2023-09-11 20:18:17 +02:00
Kconfig cpufreq: Make CONFIG_CPUFREQ_DT_PLATDEV depend on OF 2023-06-30 09:43:43 +02:00
Kconfig.arm cpufreq: Fix typo in the ARM_BRCMSTB_AVS_CPUFREQ Kconfig entry 2023-03-22 20:14:37 +01:00
Kconfig.powerpc
Kconfig.x86 cpufreq: amd-pstate: Add a kernel config option to set default mode 2023-06-21 18:44:56 +02:00
kirkwood-cpufreq.c cpufreq: kirkwood: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
longhaul.c cpufreq: longhaul: Make array speeds static const 2022-11-03 19:13:34 +01:00
longhaul.h
longrun.c
loongson2_cpufreq.c cpufreq: loongson2: Remove unused linux/sched.h headers 2021-06-07 17:43:52 +02:00
Makefile Power management updates for 6.3-rc1 2023-02-21 12:13:58 -08:00
maple-cpufreq.c cpufreq: Adjust includes to remove of_device.h 2023-04-13 17:46:35 -05:00
mediatek-cpufreq-hw.c cpufreq: mediatek-hw: Convert to platform remove callback returning void 2023-07-20 16:02:12 +05:30
mediatek-cpufreq.c cpufreq: mediatek-hw: Remove unused define 2023-08-11 06:15:21 +05:30
mvebu-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 2) 2022-06-10 14:51:35 +02:00
omap-cpufreq.c cpufreq: omap: Convert to platform remove callback returning void 2023-07-20 16:02:14 +05:30
p4-clockmod.c
pasemi-cpufreq.c cpufreq: Prepare cleanup of powerpc's asm/prom.h 2022-04-13 17:18:45 +02:00
pcc-cpufreq.c cpufreq: pcc: Fix the potentinal scheduling delays in target_index() 2023-08-29 20:41:29 +02:00
pmac32-cpufreq.c Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
pmac64-cpufreq.c cpufreq: Adjust includes to remove of_device.h 2023-04-13 17:46:35 -05:00
powernow-k6.c
powernow-k7.c
powernow-k7.h
powernow-k8.c cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit() 2023-08-28 12:27:30 +05:30
powernow-k8.h
powernv-cpufreq.c cpufreq: Introducing CPUFREQ_RELATION_E 2021-10-05 16:33:05 +02:00
ppc_cbe_cpufreq.c cpufreq: Explicitly include correct DT includes 2023-07-20 16:01:57 +05:30
ppc_cbe_cpufreq.h
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c cpufreq: Explicitly include correct DT includes 2023-07-20 16:01:57 +05:30
pxa2xx-cpufreq.c cpufreq: pxa3: move clk register access to clk driver 2022-05-07 22:55:49 +02:00
pxa3xx-cpufreq.c cpufreq: pxa3: move clk register access to clk driver 2022-05-07 22:55:49 +02:00
qcom-cpufreq-hw.c cpufreq: qcom-cpufreq-hw: add support for 4 freq domains 2023-08-23 20:31:08 +05:30
qcom-cpufreq-nvmem.c cpufreq: qcom-nvmem: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
qoriq-cpufreq.c cpufreq: qoriq: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
raspberrypi-cpufreq.c cpufreq: raspberrypi: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
s3c64xx-cpufreq.c
s5pv210-cpufreq.c cpufreq: Introducing CPUFREQ_RELATION_E 2021-10-05 16:33:05 +02:00
sa1110-cpufreq.c ARM: sa1100: remove unused board files 2023-01-12 10:53:12 +01:00
sc520_freq.c cpufreq: sc520_freq: add 'fallthrough' to one case 2021-05-21 18:52:13 +02:00
scmi-cpufreq.c cpufreq: Use of_property_present() for testing DT property presence 2023-03-13 09:58:11 +05:30
scpi-cpufreq.c cpufreq: scpi: Convert to platform remove callback returning void 2023-07-20 16:02:12 +05:30
sh-cpufreq.c cpufreq: sh: Remove sh_cpufreq_cpu_ready() 2021-09-02 18:04:17 +02:00
sparc-us2e-cpufreq.c cpufreq: sparc: Don't mark cpufreq callbacks with __init 2023-07-12 12:45:18 +02:00
sparc-us3-cpufreq.c cpufreq: sparc: Don't mark cpufreq callbacks with __init 2023-07-12 12:45:18 +02:00
spear-cpufreq.c cpufreq: Adjust includes to remove of_device.h 2023-04-13 17:46:35 -05:00
speedstep-centrino.c
speedstep-ich.c
speedstep-lib.c
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c cpufreq: Explicitly include correct DT includes 2023-07-20 16:01:57 +05:30
sun50i-cpufreq-nvmem.c cpufreq: sun50i: Convert to platform remove callback returning void 2023-07-20 16:02:12 +05:30
tegra20-cpufreq.c Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
tegra124-cpufreq.c Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
tegra186-cpufreq.c cpufreq: tegra186: Convert to platform remove callback returning void 2023-07-20 16:02:13 +05:30
tegra194-cpufreq.c cpufreq: tegra194: remove opp table in exit hook 2023-08-28 15:45:24 +05:30
ti-cpufreq.c cpufreq: Explicitly include correct DT includes 2023-07-20 16:01:57 +05:30
vexpress-spc-cpufreq.c cpufreq: vexpress: Convert to platform remove callback returning void 2023-07-20 16:02:12 +05:30