aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/ras/mce_amd_inj.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/x86/ras/mce_amd_inj.c b/arch/x86/ras/mce_amd_inj.c
index 17e35b5bf779..4fd8bb9b90b9 100644
--- a/arch/x86/ras/mce_amd_inj.c
+++ b/arch/x86/ras/mce_amd_inj.c
@@ -129,12 +129,9 @@ static ssize_t flags_write(struct file *filp, const char __user *ubuf,
129{ 129{
130 char buf[MAX_FLAG_OPT_SIZE], *__buf; 130 char buf[MAX_FLAG_OPT_SIZE], *__buf;
131 int err; 131 int err;
132 size_t ret;
133 132
134 if (cnt > MAX_FLAG_OPT_SIZE) 133 if (cnt > MAX_FLAG_OPT_SIZE)
135 cnt = MAX_FLAG_OPT_SIZE; 134 return -EINVAL;
136
137 ret = cnt;
138 135
139 if (copy_from_user(&buf, ubuf, cnt)) 136 if (copy_from_user(&buf, ubuf, cnt))
140 return -EFAULT; 137 return -EFAULT;
@@ -150,9 +147,9 @@ static ssize_t flags_write(struct file *filp, const char __user *ubuf,
150 return err; 147 return err;
151 } 148 }
152 149
153 *ppos += ret; 150 *ppos += cnt;
154 151
155 return ret; 152 return cnt;
156} 153}
157 154
158static const struct file_operations flags_fops = { 155static const struct file_operations flags_fops = {