]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: Use boolean returns for Posted Interrupt "test" helpers
authorSean Christopherson <seanjc@google.com>
Sat, 9 Oct 2021 02:12:16 +0000 (19:12 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Dec 2021 09:24:55 +0000 (04:24 -0500)
commitec5804f9b9ed665db2f94d703c15a8fb2f42c941
tree01da8e0db8e16d914f1ecb8257f90409f9a405ed
parent4bdfa68e1c6a158f800616fc3aa2d14f3df1e56d
KVM: VMX: Use boolean returns for Posted Interrupt "test" helpers

Return bools instead of ints for the posted interrupt "test" helpers.
The bit position of the flag being test does not matter to the callers,
and is in fact lost by virtue of test_bit() itself returning a bool.

Returning ints is potentially dangerous, e.g. "pi_test_on(pi_desc) == 1"
is safe-ish because ON is bit 0 and thus any sane implementation of
pi_test_on() will work, but for SN (bit 1), checking "== 1" would rely on
pi_test_on() to return 0 or 1, a.k.a. bools, as opposed to 0 or 2 (the
positive bit position).

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211009021236.4122790-24-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/posted_intr.c
arch/x86/kvm/vmx/posted_intr.h