Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 109301
b: refs/heads/master
c: 9ea2b82
h: refs/heads/master
i:
  109299: a274382
v: v3
  • Loading branch information
H. Peter Anvin committed Aug 26, 2008
1 parent 9b5434f commit 683d7ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85f1cb60157e06d9e8996b02fad9ba6964523d75
refs/heads/master: 9ea2b82ed6265a31f9a84886d74d8a2ef01b27c8
14 changes: 9 additions & 5 deletions trunk/arch/x86/kernel/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +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;
int err;
ssize_t bytes = 0;
int err = 0;

if (count % 16)
return -EINVAL; /* Invalid chunk size */
Expand All @@ -99,14 +100,17 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
cmd.ecx = pos >> 32;
err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1);
if (err)
return err;
if (copy_to_user(tmp, &cmd, 16))
return -EFAULT;
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)
Expand Down

0 comments on commit 683d7ea

Please sign in to comment.