summaryrefslogtreecommitdiffstats
path: root/fs/debugfs
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-05-03 19:17:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-14 16:48:18 +0200
commit964f8363a1aba6cb4198bfaaac538b08f1c538f1 (patch)
treef0094366ed90d68f80f0e6762d6e81b674d1ecec /fs/debugfs
parentf0a462970ee19930518b03798a21cfdb3fd35877 (diff)
downloadlinux-964f8363a1aba6cb4198bfaaac538b08f1c538f1.tar.bz2
debugfs: 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/debugfs')
-rw-r--r--fs/debugfs/file.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 1f99678ff5d3..4fce1da7db23 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -796,19 +796,13 @@ EXPORT_SYMBOL_GPL(debugfs_read_file_bool);
ssize_t debugfs_write_file_bool(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
- char buf[32];
- size_t buf_size;
bool bv;
int r;
bool *val = file->private_data;
struct dentry *dentry = F_DENTRY(file);
- buf_size = min(count, (sizeof(buf)-1));
- if (copy_from_user(buf, user_buf, buf_size))
- return -EFAULT;
-
- buf[buf_size] = '\0';
- if (strtobool(buf, &bv) == 0) {
+ r = kstrtobool_from_user(user_buf, count, &bv);
+ if (!r) {
r = debugfs_file_get(dentry);
if (unlikely(r))
return r;