Thread (115 messages) 115 messages, 9 authors, 2021-07-05

Re: [PATCH 5.10 049/101] KVM: selftests: Fix kvm_check_cap() assertion

From: Paolo Bonzini <pbonzini@redhat.com>
Date: 2021-07-05 12:00:41
Also in: lkml

On 05/07/21 09:10, Fuad Tabba wrote:
quoted
quoted
       ret = ioctl(kvm_fd, KVM_CHECK_EXTENSION, cap);
-     TEST_ASSERT(ret != -1, "KVM_CHECK_EXTENSION IOCTL failed,\n"
+     TEST_ASSERT(ret >= 0, "KVM_CHECK_EXTENSION IOCTL failed,\n"
               "  rc: %i errno: %i", ret, errno);
There's at least one case that I am aware of that potentially would
return a value other than -1 on error, which is a check for
KVM_CAP_MSI_DEVID (-EINVAL, -22):

https://elixir.bootlin.com/linux/latest/source/arch/arm64/kvm/arm.c#L229
In userspace that becomes -1, errno == EINVAL.  I probably just misread 
the "ret != -1" as "ret == 0" when applying this patch; it doesn't hurt 
but it is certainly not needed for stable.

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help