All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, Gleb Natapov <gleb@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, kvm@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] KVM: always initialize *pdata in get_msr()
Date: Fri, 23 Jan 2015 17:50:41 +0000	[thread overview]
Message-ID: <54C289F1.7000009@redhat.com> (raw)
In-Reply-To: <20150123143232.GA4298@mwanda>



On 23/01/2015 15:32, Dan Carpenter wrote:
> Smatch complains that there are some paths where we use uninitialized
> data in em_sysenter().
> 
>         arch/x86/kvm/emulate.c:2410 em_sysenter()
>         error: potentially using uninitialized 'msr_data'.

The right thing to do is to ensure that the value is set if get_msr
returns 0.  If it returns 1, msr_data is not used.

This one is obviously a false positive, so I'm not applying the patch
for now.

Paolo

> A couple examples of paths which don't set "pdata" are found in
> get_msr_hyperv() and kvm_x2apic_msr_read().  I looked at this code and
> it seems like setting it to zero is a common default behaviour.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis only, not from real life.

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, Gleb Natapov <gleb@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, kvm@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] KVM: always initialize *pdata in get_msr()
Date: Fri, 23 Jan 2015 18:50:41 +0100	[thread overview]
Message-ID: <54C289F1.7000009@redhat.com> (raw)
In-Reply-To: <20150123143232.GA4298@mwanda>



On 23/01/2015 15:32, Dan Carpenter wrote:
> Smatch complains that there are some paths where we use uninitialized
> data in em_sysenter().
> 
>         arch/x86/kvm/emulate.c:2410 em_sysenter()
>         error: potentially using uninitialized 'msr_data'.

The right thing to do is to ensure that the value is set if get_msr
returns 0.  If it returns 1, msr_data is not used.

This one is obviously a false positive, so I'm not applying the patch
for now.

Paolo

> A couple examples of paths which don't set "pdata" are found in
> get_msr_hyperv() and kvm_x2apic_msr_read().  I looked at this code and
> it seems like setting it to zero is a common default behaviour.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis only, not from real life.

  parent reply	other threads:[~2015-01-23 17:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 14:32 [patch] KVM: always initialize *pdata in get_msr() Dan Carpenter
2015-01-23 14:32 ` Dan Carpenter
2015-01-23 16:08 ` Radim Krčmář
2015-01-23 16:08   ` Radim Krčmář
2015-01-24  9:26   ` Dan Carpenter
2015-01-24  9:26     ` Dan Carpenter
2015-01-23 17:50 ` Paolo Bonzini [this message]
2015-01-23 17:50   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C289F1.7000009@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gleb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.