From: Paolo Bonzini <pbonzini@redhat.com>
To: Borislav Petkov <bp@suse.de>
Cc: kbuild test robot <fengguang.wu@intel.com>,
kbuild-all@01.org, kvm@vger.kernel.org
Subject: Re: [kvm:queue 6/21] arch/x86/kvm/cpuid.c:564:39: sparse: dereference of noderef expression
Date: Mon, 11 Nov 2013 15:23:40 +0100 [thread overview]
Message-ID: <5280E86C.7070808@redhat.com> (raw)
In-Reply-To: <20131106144602.GD16072@x1.alien8.de>
Il 06/11/2013 15:46, Borislav Petkov ha scritto:
> From: Borislav Petkov <bp@suse.de>
> Subject: [PATCH] kvm, cpuid: Fix sparse warning
>
> We need to copy padding to kernel space first before looking at it.
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
> arch/x86/kvm/cpuid.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 8f66fba804e4..c6976257eff5 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -564,6 +564,7 @@ static bool sanity_check_entries(struct kvm_cpuid_entry2 __user *entries,
> __u32 num_entries, unsigned int ioctl_type)
> {
> int i;
> + __u32 pad[3];
>
> if (ioctl_type != KVM_GET_EMULATED_CPUID)
> return false;
> @@ -577,9 +578,10 @@ static bool sanity_check_entries(struct kvm_cpuid_entry2 __user *entries,
> * sheds a tear.
> */
> for (i = 0; i < num_entries; i++) {
> - if (entries[i].padding[0] ||
> - entries[i].padding[1] ||
> - entries[i].padding[2])
> + if (copy_from_user(pad, entries[i].padding, sizeof(pad)))
> + return true;
> +
> + if (pad[0] || pad[1] || pad[2])
> return true;
> }
> return false;
>
Applied by Gleb -- thanks.
Paolo
prev parent reply other threads:[~2013-11-11 14:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5274ceff.6z2MzJI/xOIjipuw%fengguang.wu@intel.com>
2013-11-06 14:46 ` [kvm:queue 6/21] arch/x86/kvm/cpuid.c:564:39: sparse: dereference of noderef expression Borislav Petkov
2013-11-11 14:23 ` Paolo Bonzini [this message]
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=5280E86C.7070808@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@suse.de \
--cc=fengguang.wu@intel.com \
--cc=kbuild-all@01.org \
--cc=kvm@vger.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.