aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <[email protected]>2024-02-08 21:48:38 +0100
committerSean Christopherson <[email protected]>2024-02-26 18:08:36 -0800
commit221d65449453846bbf6801d0ecf7dfdf4f413ad9 (patch)
tree418e6d9f9d60eed612f851d300000e12524f11d0
parente10086285659bb7ecc5819e5c7e47f5bdc02668d (diff)
KVM: selftests: x86: sync_regs_test: Get regs structure before modifying it
The regs structure just accidentally contains the right values from the previous test in the spot where we want to change rbx. It's cleaner if we properly initialize the structure here before using it. Suggested-by: Sean Christopherson <[email protected]> Signed-off-by: Thomas Huth <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
-rw-r--r--tools/testing/selftests/kvm/x86_64/sync_regs_test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/sync_regs_test.c b/tools/testing/selftests/kvm/x86_64/sync_regs_test.c
index 8c3898cf79b3..1cd19dfa0046 100644
--- a/tools/testing/selftests/kvm/x86_64/sync_regs_test.c
+++ b/tools/testing/selftests/kvm/x86_64/sync_regs_test.c
@@ -315,6 +315,7 @@ int main(int argc, char *argv[])
run->kvm_valid_regs = 0;
run->kvm_dirty_regs = 0;
run->s.regs.regs.rbx = 0xAAAA;
+ vcpu_regs_get(vcpu, &regs);
regs.rbx = 0xBAC0;
vcpu_regs_set(vcpu, &regs);
vcpu_run(vcpu);