summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/smp.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-05-29 09:33:48 -0400
committerMarcel Holtmann <marcel@holtmann.org>2018-05-30 02:16:04 -0400
commit3bf5e97d7bbd175248da02efca2b265d13fb6041 (patch)
treec52acb227090112c167fc5ceff3c5a3fb1d32d7d /net/bluetooth/smp.c
parent9960521c44a5d828f29636ceac0600603ecbddbf (diff)
Bluetooth: 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: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r--net/bluetooth/smp.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index a2ddae2f37d7..ae91e2d40056 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -3315,16 +3315,12 @@ static ssize_t force_bredr_smp_write(struct file *file,
3315 size_t count, loff_t *ppos) 3315 size_t count, loff_t *ppos)
3316{ 3316{
3317 struct hci_dev *hdev = file->private_data; 3317 struct hci_dev *hdev = file->private_data;
3318 char buf[32];
3319 size_t buf_size = min(count, (sizeof(buf)-1));
3320 bool enable; 3318 bool enable;
3319 int err;
3321 3320
3322 if (copy_from_user(buf, user_buf, buf_size)) 3321 err = kstrtobool_from_user(user_buf, count, &enable);
3323 return -EFAULT; 3322 if (err)
3324 3323 return err;
3325 buf[buf_size] = '\0';
3326 if (strtobool(buf, &enable))
3327 return -EINVAL;
3328 3324
3329 if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) 3325 if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
3330 return -EALREADY; 3326 return -EALREADY;