aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/msr.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/msr.c')
-rw-r--r--arch/x86/kernel/msr.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index e43938086885..9c34a1005dba 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -79,8 +79,11 @@ static ssize_t msr_read(struct file *file, char __user *buf,
79 79
80 for (; count; count -= 8) { 80 for (; count; count -= 8) {
81 err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]); 81 err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]);
82 if (err) 82 if (err) {
83 return -EIO; 83 if (err == -EFAULT) /* Fix idiotic error code */
84 err = -EIO;
85 return err;
86 }
84 if (copy_to_user(tmp, &data, 8)) 87 if (copy_to_user(tmp, &data, 8))
85 return -EFAULT; 88 return -EFAULT;
86 tmp += 2; 89 tmp += 2;
@@ -105,8 +108,11 @@ static ssize_t msr_write(struct file *file, const char __user *buf,
105 if (copy_from_user(&data, tmp, 8)) 108 if (copy_from_user(&data, tmp, 8))
106 return -EFAULT; 109 return -EFAULT;
107 err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]); 110 err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]);
108 if (err) 111 if (err) {
109 return -EIO; 112 if (err == -EFAULT) /* Fix idiotic error code */
113 err = -EIO;
114 return err;
115 }
110 tmp += 2; 116 tmp += 2;
111 } 117 }
112 118