|
@@ -1187,17 +1187,16 @@ static ssize_t proc_fault_inject_write(struct file * file,
|
|
count = sizeof(buffer) - 1;
|
|
count = sizeof(buffer) - 1;
|
|
if (copy_from_user(buffer, buf, count))
|
|
if (copy_from_user(buffer, buf, count))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
- make_it_fail = simple_strtol(buffer, &end, 0);
|
|
|
|
- if (*end == '\n')
|
|
|
|
- end++;
|
|
|
|
|
|
+ make_it_fail = simple_strtol(strstrip(buffer), &end, 0);
|
|
|
|
+ if (*end)
|
|
|
|
+ return -EINVAL;
|
|
task = get_proc_task(file->f_dentry->d_inode);
|
|
task = get_proc_task(file->f_dentry->d_inode);
|
|
if (!task)
|
|
if (!task)
|
|
return -ESRCH;
|
|
return -ESRCH;
|
|
task->make_it_fail = make_it_fail;
|
|
task->make_it_fail = make_it_fail;
|
|
put_task_struct(task);
|
|
put_task_struct(task);
|
|
- if (end - buffer == 0)
|
|
|
|
- return -EIO;
|
|
|
|
- return end - buffer;
|
|
|
|
|
|
+
|
|
|
|
+ return count;
|
|
}
|
|
}
|
|
|
|
|
|
static const struct file_operations proc_fault_inject_operations = {
|
|
static const struct file_operations proc_fault_inject_operations = {
|