summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpuid.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-25 22:45:37 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-08-25 22:45:37 -0700
commit94d4ac2f4a58c6e37876827c6688c61cef21290c (patch)
tree732f4e4794f3c116041242f69754637f75c0dd57 /arch/x86/kernel/cpuid.c
parented21763e7b0b3fb50e4efd9d4bc17ef5b035d304 (diff)
parent08970fc4e0385790a7b093adfaa4165a189f9eb0 (diff)
downloadkernel-common-94d4ac2f4a58c6e37876827c6688c61cef21290c.tar.gz
kernel-common-94d4ac2f4a58c6e37876827c6688c61cef21290c.tar.bz2
kernel-common-94d4ac2f4a58c6e37876827c6688c61cef21290c.zip
Merge branch 'x86/urgent' into x86/cleanups
Diffstat (limited to 'arch/x86/kernel/cpuid.c')
-rw-r--r--arch/x86/kernel/cpuid.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 3fa4e926b510..6a44d6465991 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -88,6 +88,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 */
@@ -95,14 +97,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)