From: Jan Beulich Date: Tue, 23 Jan 2018 09:44:43 +0000 (+0100) Subject: add check to cpumask_of() X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~716 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e8bf5addc9aa4730f2c5ed481bf6d40545c8d65b;p=xen.git add check to cpumask_of() Just like any other function's CPU inputs, the one here shouldn't go unchecked. Signed-off-by: Jan Beulich Reviewed-by: Wei Liu --- diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h index 3f340d619a..42340a098e 100644 --- a/xen/include/xen/cpumask.h +++ b/xen/include/xen/cpumask.h @@ -304,7 +304,9 @@ extern const unsigned long static inline const cpumask_t *cpumask_of(unsigned int cpu) { - const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; + const unsigned long *p = cpu_bit_bitmap[1 + cpumask_check(cpu) % + BITS_PER_LONG]; + return (const cpumask_t *)(p - cpu / BITS_PER_LONG); }