Thread (21 messages) flat view 21 messages, 4 authors, 2023-08-17

Re: [PATCH v3 5/6] KVM: PPC: Add support for nestedv2 guests

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2023-08-17 04:20:40
Also in: kvm

Jordan Niethe [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 2357545dffd7..7d5edbc6ecd9 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4165,7 +4231,10 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
 	vcpu_vpa_increment_dispatch(vcpu);
 
 	if (kvmhv_on_pseries()) {
-		trap = kvmhv_vcpu_entry_p9_nested(vcpu, time_limit, lpcr, tb);
+		if (kvmhv_is_nestedv1())
+			trap = kvmhv_vcpu_entry_p9_nested(vcpu, time_limit, lpcr, tb);
+		else if (kvmhv_is_nestedv2())
+			trap = kvmhv_vcpu_entry_nestedv2(vcpu, time_limit, lpcr, tb);
Clang warns:

/linux/arch/powerpc/kvm/book3s_hv.c:4236:12: error: variable 'trap' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                else if (kvmhv_is_nestedv2())
                         ^~~~~~~~~~~~~~~~~~~
/linux/arch/powerpc/kvm/book3s_hv.c:4240:7: note: uninitialized use occurs here
                if (trap == BOOK3S_INTERRUPT_SYSCALL && !nested &&
                    ^~~~
/linux/arch/powerpc/kvm/book3s_hv.c:4236:8: note: remove the 'if' if its condition is always true
                else if (kvmhv_is_nestedv2())
                     ^~~~~~~~~~~~~~~~~~~~~~~~
/linux/arch/powerpc/kvm/book3s_hv.c:4219:10: note: initialize the variable 'trap' to silence this warning
        int trap;
                ^
                 = 0

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