Message ID | CAKwvOdnhPCDRFMhYiAr2kSCDWrL_gaY8c6XHJ96PupcN-wcDpQ@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 19/06/2018 19:08, Nick Desaulniers wrote: >> This one really makes the code uglier though, so I'm not really inclined >> to applying the patch. > Note that of the three variables (w, u, x), only u is used later on. > What about declaring them as negated with the cast, that way there's > no cast in a ternary? I still find it inferior, but I guess it's at least acceptable. I prefer not_{x,w,u} though. :) Paolo
On Tue, Jun 19, 2018 at 07:13:41PM +0200, Paolo Bonzini wrote: > On 19/06/2018 19:08, Nick Desaulniers wrote: > >> This one really makes the code uglier though, so I'm not really inclined > >> to applying the patch. > > Note that of the three variables (w, u, x), only u is used later on. > > What about declaring them as negated with the cast, that way there's > > no cast in a ternary? > > I still find it inferior, but I guess it's at least acceptable. I > prefer not_{x,w,u} though. :) Thanks Nick and Paolo for the suggestions, I'll sent an updated version soon.
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d594690d8b95..53673ad4b295 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4261,8 +4261,9 @@ static void update_permission_bitmask(struct kvm_vcpu *vcpu, { unsigned byte; - const u8 x = BYTE_MASK(ACC_EXEC_MASK); - const u8 w = BYTE_MASK(ACC_WRITE_MASK); + const u8 x_not = (u8)~BYTE_MASK(ACC_EXEC_MASK); + const u8 w_not = (u8)~BYTE_MASK(ACC_WRITE_MASK); + const u8 u_not = (u8)~BYTE_MASK(ACC_USER_MASK); const u8 u = BYTE_MASK(ACC_USER_MASK);