diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-09-05 17:53:05 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-09-05 17:53:05 +0200 |
| commit | 28c3cfd5fb998bd3683bebeebbba38baa2101cad (patch) | |
| tree | 3d325023e6dc56baa6c69fc59dd55bf37ef7967e /arch/x86/kernel/cpuid.c | |
| parent | 04197c83b3e05546d1003cfa3ff43f1639c0057f (diff) | |
| parent | b380b0d4f7dffcc235c0facefa537d4655619101 (diff) | |
| download | linux-28c3cfd5fb998bd3683bebeebbba38baa2101cad.tar.gz linux-28c3cfd5fb998bd3683bebeebbba38baa2101cad.tar.bz2 linux-28c3cfd5fb998bd3683bebeebbba38baa2101cad.zip | |
Merge branch 'linus' into x86/tracehook
Diffstat (limited to 'arch/x86/kernel/cpuid.c')
| -rw-r--r-- | arch/x86/kernel/cpuid.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 14b11b3be31c..8e9cd6a8ec12 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c @@ -89,6 +89,8 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, struct cpuid_regs cmd; int cpu = iminor(file->f_path.dentry->d_inode); u64 pos = *ppos; + ssize_t bytes = 0; + int err = 0; if (count % 16) return -EINVAL; /* Invalid chunk size */ @@ -96,14 +98,19 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, for (; count; count -= 16) { cmd.eax = pos; cmd.ecx = pos >> 32; - smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); - if (copy_to_user(tmp, &cmd, 16)) - return -EFAULT; + err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); + if (err) + break; + if (copy_to_user(tmp, &cmd, 16)) { + err = -EFAULT; + break; + } tmp += 16; + bytes += 16; *ppos = ++pos; } - return tmp - buf; + return bytes ? bytes : err; } static int cpuid_open(struct inode *inode, struct file *file) |
