public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Fix warning in emulator_cmpxchg_emulated
@ 2011-12-08  6:17 Sasha Levin
  2011-12-08  8:04 ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2011-12-08  6:17 UTC (permalink / raw)
  To: kvm, avi, mtosatti; +Cc: Sasha Levin

Make sure 'exchanged' is initialized. Fixes the following warning:

arch/x86/kvm/x86.c: In function 'emulator_cmpxchg_emulated':
arch/x86/kvm/x86.c:3794:7: warning: 'exchanged' may be used uninitialized in this function

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 arch/x86/kvm/x86.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index eeeaf2e..9338afc 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3791,7 +3791,7 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt,
 	gpa_t gpa;
 	struct page *page;
 	char *kaddr;
-	bool exchanged;
+	bool exchanged = false;
 
 	/* guests cmpxchg8b have to be emulated atomically */
 	if (bytes > 8 || (bytes & (bytes - 1)))
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: Fix warning in emulator_cmpxchg_emulated
  2011-12-08  6:17 [PATCH] KVM: Fix warning in emulator_cmpxchg_emulated Sasha Levin
@ 2011-12-08  8:04 ` Jan Kiszka
  2011-12-08  8:25   ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2011-12-08  8:04 UTC (permalink / raw)
  To: Sasha Levin; +Cc: kvm, avi, mtosatti

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

On 2011-12-08 07:17, Sasha Levin wrote:
> Make sure 'exchanged' is initialized. Fixes the following warning:
> 
> arch/x86/kvm/x86.c: In function 'emulator_cmpxchg_emulated':
> arch/x86/kvm/x86.c:3794:7: warning: 'exchanged' may be used uninitialized in this function
> 
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>  arch/x86/kvm/x86.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index eeeaf2e..9338afc 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3791,7 +3791,7 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt,
>  	gpa_t gpa;
>  	struct page *page;
>  	char *kaddr;
> -	bool exchanged;
> +	bool exchanged = false;
>  
>  	/* guests cmpxchg8b have to be emulated atomically */
>  	if (bytes > 8 || (bytes & (bytes - 1)))

Isn't BUG() tagged as no-return in the kernel? Because this
initialization is obviously unneeded.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: Fix warning in emulator_cmpxchg_emulated
  2011-12-08  8:04 ` Jan Kiszka
@ 2011-12-08  8:25   ` Sasha Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2011-12-08  8:25 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm, avi, mtosatti

On Thu, 2011-12-08 at 09:04 +0100, Jan Kiszka wrote:
> On 2011-12-08 07:17, Sasha Levin wrote:
> > Make sure 'exchanged' is initialized. Fixes the following warning:
> > 
> > arch/x86/kvm/x86.c: In function 'emulator_cmpxchg_emulated':
> > arch/x86/kvm/x86.c:3794:7: warning: 'exchanged' may be used uninitialized in this function
> > 
> > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> > ---
> >  arch/x86/kvm/x86.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index eeeaf2e..9338afc 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -3791,7 +3791,7 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt,
> >  	gpa_t gpa;
> >  	struct page *page;
> >  	char *kaddr;
> > -	bool exchanged;
> > +	bool exchanged = false;
> >  
> >  	/* guests cmpxchg8b have to be emulated atomically */
> >  	if (bytes > 8 || (bytes & (bytes - 1)))
> 
> Isn't BUG() tagged as no-return in the kernel? Because this
> initialization is obviously unneeded.

It looks like __builtin_unreachable() requires a gcc newer than mine.

-- 

Sasha.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-08  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08  6:17 [PATCH] KVM: Fix warning in emulator_cmpxchg_emulated Sasha Levin
2011-12-08  8:04 ` Jan Kiszka
2011-12-08  8:25   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox