Skip to contentSkip to conversation

kvm/ppc: fix build warning

PATCH In review Denis Kirjanov 3 participants 5 messages Jun 24, 2010 – Jun 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm/ppc: fix build warning

Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function 'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used uninitialized in this function

---
arch/powerpc/kvm/book3s_64_mmu.c | 2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kvm/book3s_64_mmu.c +1 -1
index 4025ea2..61f2621 100644
@@ -443,7 +443,7 @@ static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
 					     u64 *vsid)
 {
 	ulong ea = esid << SID_SHIFT;
-	struct kvmppc_slb *slb;
+	struct kvmppc_slb *uninitialized_var(slb);
 	u64 gvsid = esid;
 
 	if (vcpu->arch.msr & (MSR_DR|MSR_IR)) {
#1 lore raw
Quoted 4 lines · Denis Kirjanov

Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function 'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used uninitialized in this function

Are you sure this isn't a broken compiler? I don't see where it could be used uninitialized.

Alex

#2 lore raw
Quoted 9 lines · Alexander Graf
Quoted 4 lines · Denis Kirjanov

Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function 'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used uninitialized in this function

Are you sure this isn't a broken compiler? I don't see where it could be used uninitialized.

I'm using gcc version 4.3.4 (Gentoo 4.3.4 p1.1, pie-10.1.5) slb pointer initialized inside conditional branch and used later in the case case MSR_DR|MSR_IR

#3 lore raw
Quoted 9 lines · Denis Kirjanov
Quoted 8 lines · Alexander Graf
Quoted 4 lines · Denis Kirjanov

Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function 'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used uninitialized in this function

Quoted 6 lines
Quoted 1 line

Are you sure this isn't a broken compiler? I don't see where it could be used uninitialized.

I'm using gcc version 4.3.4 (Gentoo 4.3.4 p1.1, pie-10.1.5) slb pointer initialized inside conditional branch and used later in the case case MSR_DR|MSR_IR

Oh, I'm apparently looking at completely different code. The same function in git://git.kernel.org/pub/scm/virt/kvm/kvm.git is good. Which tree did you use?

Alex

#4 lore raw
In reply to Denis Kirjanov
Quoted 11 lines · Denis Kirjanov
Quoted 10 lines · Alexander Graf
Quoted 6 lines · Denis Kirjanov

Fix build warning:
arch/powerpc/kvm/book3s_64_mmu.c: In function 'kvmppc_mmu_book3s_64_esid_to_vsid':
arch/powerpc/kvm/book3s_64_mmu.c:446: warning: 'slb' may be used uninitialized in this function

Quoted 7 lines
Quoted 2 lines

Are you sure this isn't a broken compiler? I don't see where it could be used uninitialized.

I'm using gcc version 4.3.4 (Gentoo 4.3.4 p1.1, pie-10.1.5) slb pointer initialized inside conditional branch and used later in the case case MSR_DR|MSR_IR

This is based on linux-next tree (-next-20100623)