On 19/01/18 16:04, Jan Beulich wrote:
> Just like any other function's CPU inputs, the one here shouldn't go
> unchecked.
>
> Signed-off-by: Jan Beulich <jbeul...@suse.com>
>
> --- 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);
>  }

This would be slightly easier to read as

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index 3f340d6..7507ae9 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);
 }
 

Otherwise, Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to