From e8bf5addc9aa4730f2c5ed481bf6d40545c8d65b Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 23 Jan 2018 10:44:43 +0100 Subject: [PATCH] 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 --- xen/include/xen/cpumask.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.30.2