]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
add check to cpumask_of()
authorJan Beulich <jbeulich@suse.com>
Tue, 23 Jan 2018 09:44:43 +0000 (10:44 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 23 Jan 2018 09:44:43 +0000 (10:44 +0100)
Just like any other function's CPU inputs, the one here shouldn't go
unchecked.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
xen/include/xen/cpumask.h

index 3f340d619a63b9cbdd675a10a8254819a677a7a4..42340a098ee4f729d4b51a946b3562d1c3bb4b9c 100644 (file)
@@ -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);
 }