cacheinfo: Initialize variables in fetch_cache_info()
authorPierre Gondois <pierre.gondois@arm.com>
Tue, 24 Jan 2023 15:40:46 +0000 (16:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Jan 2023 15:02:02 +0000 (16:02 +0100)
Set potentially uninitialized variables to 0. This is particularly
relevant when CONFIG_ACPI_PPTT is not set.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/all/202301052307.JYt1GWaJ-lkp@intel.com/
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/all/Y86iruJPuwNN7rZw@kili/
Fixes: 5944ce092b97 ("arch_topology: Build cacheinfo from primary CPU")
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230124154053.355376-2-pierre.gondois@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/cacheinfo.c

index 418a18acc8f9e0aa0ca3bc4f9495e1b67397928e..f6573c335f4c4c17b6d5277d3af75e9e31226409 100644 (file)
@@ -424,7 +424,7 @@ int allocate_cache_info(int cpu)
 int fetch_cache_info(unsigned int cpu)
 {
        struct cpu_cacheinfo *this_cpu_ci;
-       unsigned int levels, split_levels;
+       unsigned int levels = 0, split_levels = 0;
        int ret;
 
        if (acpi_disabled) {