diff mbox

kvm: Fix build warnings

Message ID 1306786278-12219-1-git-send-email-bp@alien8.de (mailing list archive)
State New, archived
Headers show

Commit Message

Borislav Petkov May 30, 2011, 8:11 p.m. UTC
On 3.0-rc1 I get

In file included from arch/x86/kvm/mmu.c:2856:
arch/x86/kvm/paging_tmpl.h: In function ‘paging32_walk_addr_generic’:
arch/x86/kvm/paging_tmpl.h:124: warning: ‘ptep_user’ may be used uninitialized in this function
In file included from arch/x86/kvm/mmu.c:2852:
arch/x86/kvm/paging_tmpl.h: In function ‘paging64_walk_addr_generic’:
arch/x86/kvm/paging_tmpl.h:124: warning: ‘ptep_user’ may be used uninitialized in this function

caused by 6e2ca7d1802bf8ed9908435e34daa116662e7790. According to Takuya
Yoshikawa, ptep_user won't be used uninitialized so shut up gcc.

Cc: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Link: http://lkml.kernel.org/r/20110530094604.GC21833@liondog.tnic
Signed-off-by: Borislav Petkov <bp@alien8.de>
---
 arch/x86/kvm/paging_tmpl.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Borislav Petkov June 7, 2011, 7:28 a.m. UTC | #1
On Tue, May 31, 2011 at 12:26:55PM +0200, Ingo Molnar wrote:
> 
> * Avi Kivity <avi@redhat.com> wrote:
> 
> > On 05/31/2011 10:38 AM, Ingo Molnar wrote:
> > >* Borislav Petkov<bp@alien8.de>  wrote:
> > >
> > >>  +++ b/arch/x86/kvm/paging_tmpl.h
> > >>  @@ -121,7 +121,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
> > >>   				gva_t addr, u32 access)
> > >>   {
> > >>   	pt_element_t pte;
> > >>  -	pt_element_t __user *ptep_user;
> > >>  +	pt_element_t __user *uninitialized_var(ptep_user);
> > >
> > >Note that doing this is actually actively dangerous for two reasons.
> > >
> > >
> > 
> > <snip lots of good advice>
> > 
> > > Please fix it instead.
> > 
> > s/instead/in addition/; while all those changes are good, they are 
> > much too large for 3.0.  Let's push the simple fix for 3.0 and 
> > queue the bigger refactoring to 3.1.
> 
> Yeah, that's probably wise, this is a tricky function.

So, any progress on this front? Warning is still there in -rc2.

Thanks.
Avi Kivity June 7, 2011, 7:58 a.m. UTC | #2
On 06/07/2011 10:28 AM, Borislav Petkov wrote:
> So, any progress on this front? Warning is still there in -rc2.
>

Thanks for the reminder, applied and queued.
diff mbox

Patch

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 6c4dc01..9d03ad4 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -121,7 +121,7 @@  static int FNAME(walk_addr_generic)(struct guest_walker *walker,
 				    gva_t addr, u32 access)
 {
 	pt_element_t pte;
-	pt_element_t __user *ptep_user;
+	pt_element_t __user *uninitialized_var(ptep_user);
 	gfn_t table_gfn;
 	unsigned index, pt_access, uninitialized_var(pte_access);
 	gpa_t pte_gpa;