|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/6] add check to cpumask_of()
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 <jbeulich@xxxxxxxx>
>
> --- 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.cooper3@xxxxxxxxxx>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |