[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77e46758-4b00-9db9-13ab-329c6dad66f3@redhat.com>
Date: Mon, 17 Aug 2020 20:56:20 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: fix access code passed to gva_to_gpa
On 17/08/20 20:42, Sean Christopherson wrote:
>
> Don't suppose you'd be in the mood to kill the bare 'unsigned'?
>
> WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
u32 is even better.
> Alternatively, what about capturing the result in a new variable (instead of
> defining the mask) to make the wrap suck less (or just overflow like the
> current code), e.g.:
>
> u32 access = error_code &
> (PFERR_WRITE_MASK | PFERR_FETCH_MASK | PFERR_USER_MASK);
>
> if (!(error_code & PFERR_PRESENT_MASK) ||
> vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, access, &fault) != UNMAPPED_GVA) {
Sure, that's better.
Paolo
Powered by blists - more mailing lists