Re: [PATCH] cpufreq: acpi-cpufreq: Initialize cmd.val in drv_read()
Zhongqiu Han <[email protected]>
| Newsgroups | org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <[email protected]> |
On 8/10/2026 2:10 PM, lirongqing wrote: > From: Li RongQing <[email protected]> > > In drv_read(), struct drv_cmd cmd is allocated on the stack with .val left > uninitialized. If smp_call_function_any() fails, do_drv_read() will not > run to populate cmd.val. As a result, drv_read() would return uninitialized > stack data. > > Fix this by explicitly initializing .val to 0 when declaring cmd. > > Signed-off-by: Li RongQing <[email protected]> > --- > drivers/cpufreq/acpi-cpufreq.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c > index cd2ca87..6c7ece9 100644 > --- a/drivers/cpufreq/acpi-cpufreq.c > +++ b/drivers/cpufreq/acpi-cpufreq.c > @@ -308,6 +308,7 @@ static u32 drv_read(struct acpi_cpufreq_data *data, const struct cpumask *mask) > struct acpi_processor_performance *perf = to_perf_data(data); > struct drv_cmd cmd = { > .reg = &perf->control_register, > + .val = 0, Will the compiler handle this automatically? https://en.cppreference.com/c/language/initialization > .func.read = data->cpu_freq_read, > }; > int err; -- Thx and BRs, Zhongqiu Han