aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpuid.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-26 01:45:37 -0400
committerH. Peter Anvin <hpa@zytor.com>2008-08-26 01:45:37 -0400
commit94d4ac2f4a58c6e37876827c6688c61cef21290c (patch)
tree732f4e4794f3c116041242f69754637f75c0dd57 /arch/x86/kernel/cpuid.c
parented21763e7b0b3fb50e4efd9d4bc17ef5b035d304 (diff)
parent08970fc4e0385790a7b093adfaa4165a189f9eb0 (diff)
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,
88 struct cpuid_regs cmd; 88 struct cpuid_regs cmd;
89 int cpu = iminor(file->f_path.dentry->d_inode); 89 int cpu = iminor(file->f_path.dentry->d_inode);
90 u64 pos = *ppos; 90 u64 pos = *ppos;
91 ssize_t bytes = 0;
92 int err = 0;
91 93
92 if (count % 16) 94 if (count % 16)
93 return -EINVAL; /* Invalid chunk size */ 95 return -EINVAL; /* Invalid chunk size */
@@ -95,14 +97,19 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
95 for (; count; count -= 16) { 97 for (; count; count -= 16) {
96 cmd.eax = pos; 98 cmd.eax = pos;
97 cmd.ecx = pos >> 32; 99 cmd.ecx = pos >> 32;
98 smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); 100 err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1);
99 if (copy_to_user(tmp, &cmd, 16)) 101 if (err)
100 return -EFAULT; 102 break;
103 if (copy_to_user(tmp, &cmd, 16)) {
104 err = -EFAULT;
105 break;
106 }
101 tmp += 16; 107 tmp += 16;
108 bytes += 16;
102 *ppos = ++pos; 109 *ppos = ++pos;
103 } 110 }
104 111
105 return tmp - buf; 112 return bytes ? bytes : err;
106} 113}
107 114
108static int cpuid_open(struct inode *inode, struct file *file) 115static int cpuid_open(struct inode *inode, struct file *file)