fault-inject: automatically detect the number base for fail-nth write interface

Automatically detect the number base to use when writing to fail-nth
file instead of always parsing as a decimal number.

Link: http://lkml.kernel.org/r/1491490561-10485-2-git-send-email-akinobu.mita@gmail.com
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Akinobu Mita 2017-07-14 14:49:49 -07:00 committed by Linus Torvalds
parent 5f92a7b0fc
commit ecaad81ca0
1 changed files with 1 additions and 1 deletions

View File

@ -1368,7 +1368,7 @@ static ssize_t proc_fail_nth_write(struct file *file, const char __user *buf,
put_task_struct(task); put_task_struct(task);
if (task != current) if (task != current)
return -EPERM; return -EPERM;
err = kstrtoint_from_user(buf, count, 10, &n); err = kstrtoint_from_user(buf, count, 0, &n);
if (err) if (err)
return err; return err;
if (n < 0 || n == INT_MAX) if (n < 0 || n == INT_MAX)