summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2013-11-06 15:46:02 +0100
committerGleb Natapov <gleb@redhat.com>2013-11-07 12:27:46 +0200
commit1b2ca42267fe8c4e909312f2b83dfef882cf6234 (patch)
tree227101073f1780d1b763e9e04389cf1fac3e520a /arch/x86
parenta890b6fefd1775a1c3a7d8fe8af968a3a7b23c04 (diff)
downloadtalos-op-linux-1b2ca42267fe8c4e909312f2b83dfef882cf6234.tar.gz
talos-op-linux-1b2ca42267fe8c4e909312f2b83dfef882cf6234.zip
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> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/cpuid.c8
1 files 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;
OpenPOWER on IntegriCloud