diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-12-14 13:02:18 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-12-14 13:05:05 -0500 |
commit | 494c2ebfb287eb10b229415063099e3700639028 (patch) | |
tree | ac55499ae26219e6c4eaad3b73fd143104048d65 /arch/x86/kernel/msr.c | |
parent | 70fe440718d9f42bf963c2cffe12008eb5556165 (diff) |
x86, msr: Remove incorrect, duplicated code in the MSR driver
The MSR driver would compute the values for cpu and c at declaration,
and then again in the body of the function. This isn't merely
redundant, but unsafe, since cpu might not refer to a valid CPU at
that point.
Remove the unnecessary and dangerous references in the declarations.
This code now matches the equivalent code in the CPUID driver.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/msr.c')
-rw-r--r-- | arch/x86/kernel/msr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 553449951b84..572b07eee3f4 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -172,11 +172,10 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg) | |||
172 | 172 | ||
173 | static int msr_open(struct inode *inode, struct file *file) | 173 | static int msr_open(struct inode *inode, struct file *file) |
174 | { | 174 | { |
175 | unsigned int cpu = iminor(file->f_path.dentry->d_inode); | 175 | unsigned int cpu; |
176 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 176 | struct cpuinfo_x86 *c; |
177 | 177 | ||
178 | cpu = iminor(file->f_path.dentry->d_inode); | 178 | cpu = iminor(file->f_path.dentry->d_inode); |
179 | |||
180 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) | 179 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) |
181 | return -ENXIO; /* No such CPU */ | 180 | return -ENXIO; /* No such CPU */ |
182 | 181 | ||