Re: [PATCH 8/9] x86, RAS: Add attributes needed for HW injection

From: David Rientjes
Date: Wed Oct 19 2011 - 17:19:14 EST


On Wed, 19 Oct 2011, Borislav Petkov wrote:

> > That wouldn't catch an offline cpuid, you probably want cpu_online(val)?
>
> Good catch, thanks.
>
> So I'm looking at <arch/x86/kernel/cpuid.c> which is how the validity of
> a cpu value should be tested properly, IMHO:
>
> static int cpuid_open(struct inode *inode, struct file *file)
> {
> ...
>
> if (cpu >= nr_cpu_ids || !cpu_online(cpu))
> return -ENXIO; /* No such CPU */
> ...

Right, the comment for cpumask_test_cpu(), which cpu_online() really is,
wants a cpu < nr_cpu_ids.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/