summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-05-03 14:45:11 +0300
committerJames Hogan <jhogan@kernel.org>2018-05-14 23:58:23 +0100
commitf83e4e1e0ef5c6db4f5c249fe485b2f1029180c5 (patch)
treeafc85153b559ffb5cf757b7005d76803100ea542 /arch
parentf06e7aa47f3cad55c5737eb87280e90e25882d60 (diff)
downloadlinux-stable-f83e4e1e0ef5c6db4f5c249fe485b2f1029180c5.tar.gz
linux-stable-f83e4e1e0ef5c6db4f5c249fe485b2f1029180c5.tar.bz2
linux-stable-f83e4e1e0ef5c6db4f5c249fe485b2f1029180c5.zip
MIPS: Re-use kstrtobool_from_user()
Re-use kstrtobool_from_user() instead of open coded variant. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Signed-off-by: James Hogan <jhogan@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/mm/sc-debugfs.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/arch/mips/mm/sc-debugfs.c b/arch/mips/mm/sc-debugfs.c
index 2e2132d3f5c7..2a116084216f 100644
--- a/arch/mips/mm/sc-debugfs.c
+++ b/arch/mips/mm/sc-debugfs.c
@@ -31,17 +31,10 @@ static ssize_t sc_prefetch_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
- char buf[32];
- ssize_t buf_size;
bool enabled;
int err;
- buf_size = min(count, sizeof(buf) - 1);
- if (copy_from_user(buf, user_buf, buf_size))
- return -EFAULT;
-
- buf[buf_size] = '\0';
- err = strtobool(buf, &enabled);
+ err = kstrtobool_from_user(user_buf, count, &enabled);
if (err)
return err;