]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: selftests: Fix a condition in test_hv_cpuid()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 14 May 2019 10:34:51 +0000 (13:34 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 24 May 2019 19:27:04 +0000 (21:27 +0200)
commit8a3e4c28d17ebd5ae5497227e7b65336fb9d583d
tree87900a1dd2e5a0b1d977a462559c462768d90532
parentd4b590fca9fb204254ee48421c3670da8c2baa0c
KVM: selftests: Fix a condition in test_hv_cpuid()

The code is trying to check that all the padding is zeroed out and it
does this:

    entry->padding[0] == entry->padding[1] == entry->padding[2] == 0

Assume everything is zeroed correctly, then the first comparison is
true, the next comparison is false and false is equal to zero so the
overall condition is true.  This bug doesn't affect run time very
badly, but the code should instead just check that all three paddings
are zero individually.

Also the error message was copy and pasted from an earlier error and it
wasn't correct.

Fixes: 84280217dad3 ("KVM: selftests: Add hyperv_cpuid test")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c