Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-15 Thread H. Peter Anvin
On 10/15/18 10:23 AM, Paolo Bonzini wrote: > > Even for a value from a 32-bit register? That would be _BIT, which > doesn't exist. > Just use _BITUL(). gcc is smart enough to know that that the resulting value is representable in 32 bits. Or if you really care, submit a patch to create _BITU()

Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-15 Thread Paolo Bonzini
On 15/10/2018 19:16, H. Peter Anvin wrote: > On 10/7/18 6:04 PM, peng.h...@zte.com.cn wrote: > \> >> #define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK(0xFF) >> -#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK(1 << 31) >> +#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK(1UL

Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-15 Thread H. Peter Anvin
On 10/7/18 6:04 PM, peng.h...@zte.com.cn wrote: \> > #define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK(0xFF) > -#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK(1 << 31) > +#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK(1UL << 31) >>> It is reasonable to change to unsi

Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-15 Thread Paolo Bonzini
On 08/10/2018 04:25, Wei Yang wrote: > On Mon, Oct 08, 2018 at 09:04:34AM +0800, peng.h...@zte.com.cn wrote: >>> On Sat, Oct 06, 2018 at 11:31:04AM +0800, peng.h...@zte.com.cn wrote: > On Thu, Oct 04, 2018 at 01:47:18PM -0400, Peng Hao wrote: >> >> From: Peng Hao >> >> modify

Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-07 Thread Wei Yang
On Mon, Oct 08, 2018 at 09:04:34AM +0800, peng.h...@zte.com.cn wrote: >>On Sat, Oct 06, 2018 at 11:31:04AM +0800, peng.h...@zte.com.cn wrote: On Thu, Oct 04, 2018 at 01:47:18PM -0400, Peng Hao wrote: > >From: Peng Hao > > modify AVIC_LOGICAL_ID_ENTRY_VALID_MASK to unsigned >>>

Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-06 Thread Wei Yang
On Sat, Oct 06, 2018 at 11:31:04AM +0800, peng.h...@zte.com.cn wrote: >>On Thu, Oct 04, 2018 at 01:47:18PM -0400, Peng Hao wrote: >>> >>>From: Peng Hao >>> >>> modify AVIC_LOGICAL_ID_ENTRY_VALID_MASK to unsigned >>> >>>Signed-off-by: Peng Hao >>>--- >>> arch/x86/kvm/svm.c | 2 +- >>> 1 file chang

Re: [PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-05 Thread Wei Yang
On Thu, Oct 04, 2018 at 01:47:18PM -0400, Peng Hao wrote: > >From: Peng Hao > > modify AVIC_LOGICAL_ID_ENTRY_VALID_MASK to unsigned > >Signed-off-by: Peng Hao >--- > arch/x86/kvm/svm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c

[PATCH] kvm/x86 : avoid shifting signed 32-bit value by 31 bits

2018-10-04 Thread Peng Hao
From: Peng Hao modify AVIC_LOGICAL_ID_ENTRY_VALID_MASK to unsigned Signed-off-by: Peng Hao --- arch/x86/kvm/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index d96092b..bf1ded4 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x8