[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/3] xen/x86: Avoid undefined behaviour by shifting into a sign bit



>>> On 05.08.16 at 15:50, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -476,7 +476,7 @@ void detect_extended_topology(struct cpuinfo_x86 *c)
>               sub_index++;
>       } while ( LEAFB_SUBTYPE(ecx) != INVALID_TYPE );
>  
> -     core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
> +     core_select_mask = (~(-1u << core_plus_mask_width)) >> ht_mask_width;

-1u is kind of bogus; could I talk you into using ~0u instead?

With that
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.