Re: [PATCH 01/23] x86/fpu: Use ULL for shift in xfeature_uncompacted_offset()

2018-11-09 Thread Sebastian Andrzej Siewior
On 2018-11-08 12:38:17 [+0100], Borislav Petkov wrote:
> Or simply BIT_ULL(xfeature_nr).

Yes, why not. Updated. Thanks.

Sebastian


Re: [PATCH 01/23] x86/fpu: Use ULL for shift in xfeature_uncompacted_offset()

2018-11-09 Thread Sebastian Andrzej Siewior
On 2018-11-08 12:38:17 [+0100], Borislav Petkov wrote:
> Or simply BIT_ULL(xfeature_nr).

Yes, why not. Updated. Thanks.

Sebastian


Re: [PATCH 01/23] x86/fpu: Use ULL for shift in xfeature_uncompacted_offset()

2018-11-08 Thread Borislav Petkov
On Wed, Nov 07, 2018 at 08:48:36PM +0100, Sebastian Andrzej Siewior wrote:
> The xfeature mask is 64bit so a shift from a number to its mask should
> have LL prefix or else nr > 31 will be lost. This is not a problem now
> but should XFEATURE_MASK_SUPERVISOR gain a bit >31 then this check won't
> catch it.
> 
> Add a ULL suffix so >31bit number will be properly shifted.
> 
> Signed-off-by: Sebastian Andrzej Siewior 
> ---
>  arch/x86/kernel/fpu/xstate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
> index 87a57b7642d36..9dc0a2c8c2755 100644
> --- a/arch/x86/kernel/fpu/xstate.c
> +++ b/arch/x86/kernel/fpu/xstate.c
> @@ -444,7 +444,7 @@ static int xfeature_uncompacted_offset(int xfeature_nr)
>* format. Checking a supervisor state's uncompacted offset is
>* an error.
>*/
> - if (XFEATURE_MASK_SUPERVISOR & (1 << xfeature_nr)) {
> + if (XFEATURE_MASK_SUPERVISOR & (1ULL << xfeature_nr)) {

Or simply BIT_ULL(xfeature_nr).

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


Re: [PATCH 01/23] x86/fpu: Use ULL for shift in xfeature_uncompacted_offset()

2018-11-08 Thread Borislav Petkov
On Wed, Nov 07, 2018 at 08:48:36PM +0100, Sebastian Andrzej Siewior wrote:
> The xfeature mask is 64bit so a shift from a number to its mask should
> have LL prefix or else nr > 31 will be lost. This is not a problem now
> but should XFEATURE_MASK_SUPERVISOR gain a bit >31 then this check won't
> catch it.
> 
> Add a ULL suffix so >31bit number will be properly shifted.
> 
> Signed-off-by: Sebastian Andrzej Siewior 
> ---
>  arch/x86/kernel/fpu/xstate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
> index 87a57b7642d36..9dc0a2c8c2755 100644
> --- a/arch/x86/kernel/fpu/xstate.c
> +++ b/arch/x86/kernel/fpu/xstate.c
> @@ -444,7 +444,7 @@ static int xfeature_uncompacted_offset(int xfeature_nr)
>* format. Checking a supervisor state's uncompacted offset is
>* an error.
>*/
> - if (XFEATURE_MASK_SUPERVISOR & (1 << xfeature_nr)) {
> + if (XFEATURE_MASK_SUPERVISOR & (1ULL << xfeature_nr)) {

Or simply BIT_ULL(xfeature_nr).

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.