ACPI: processor: Fix uninitialized access of buf in acpi_set_pdc_bits()
authorMichal Wilczynski <michal.wilczynski@intel.com>
Thu, 14 Sep 2023 22:25:27 +0000 (01:25 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 18 Sep 2023 10:16:16 +0000 (12:16 +0200)
A bug was introduced during unification of setting CAP_SMP_T_SWCOORD for
the _PDC and _OSC methods.

The third u32 in the buffer is never cleared before setting bits on it.
The memory is not guaranteed to be zero as it was allocated by kmalloc()
instead of kzalloc().

Fix this by initializing the third u32 in the buffer to 0.

Fixes: b9e8d0168a7a ("ACPI: processor: Set CAP_SMP_T_SWCOORD in arch_acpi_set_proc_cap_bits()")
Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/processor_pdc.c

index 1a8591e9a9bf1a215b058ee227e6b1ec8fe8c4d5..994091bd52de4027877638c66a02d41e100b4748 100644 (file)
@@ -19,6 +19,7 @@ static void acpi_set_pdc_bits(u32 *buf)
 {
        buf[0] = ACPI_PDC_REVISION_ID;
        buf[1] = 1;
+       buf[2] = 0;
 
        /* Twiddle arch-specific bits needed for _PDC */
        arch_acpi_set_proc_cap_bits(&buf[2]);