Re: [PATCH 4/4] x86/cpu/topology: Implement the CPU type sysfs interface
From: Randy Dunlap
Date: Fri Oct 02 2020 - 23:37:05 EST
On 10/2/20 6:17 PM, Ricardo Neri wrote:
> +u32 arch_get_cpu_type(int cpu)
> +{
> + struct cpuinfo_x86 *c = &cpu_data(cpu);
> +
> + if (cpu < 0 || cpu >= nr_cpu_ids)
> + return 0;
> +
> + return c->x86_cpu_type;> +}
Hi,
Consider using
#include <linux/nospec.h>
and array_index_nospec() to avoid speculation problems on cpu_data.
cheers.
--
~Randy