diff options
| author | Dmitry Antipov <dmantipov@yandex.ru> | 2026-06-17 18:30:19 +0300 |
|---|---|---|
| committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2026-08-07 12:27:39 -0400 |
| commit | 288f31431be58d8d8b5f8524a8dd8e2aa2713fc0 (patch) | |
| tree | b5792aeffa05d209525e7a39cc060ec6423fa435 | |
| parent | e01e99a5ec2143d441c6ca0ce89abf3adb61cc12 (diff) | |
| download | linux-288f31431be58d8d8b5f8524a8dd8e2aa2713fc0.tar.gz linux-288f31431be58d8d8b5f8524a8dd8e2aa2713fc0.zip | |
Bluetooth: simplify force_no_mitm_write() with kstrtobool_from_user()
Simplify 'force_no_mitm_write()' by using the convenient
'kstrtobool_from_user()'.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
| -rw-r--r-- | net/bluetooth/hci_debugfs.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c index 0635e4641db4..aadffaaff20e 100644 --- a/net/bluetooth/hci_debugfs.c +++ b/net/bluetooth/hci_debugfs.c @@ -1161,16 +1161,12 @@ static ssize_t force_no_mitm_write(struct file *file, size_t count, loff_t *ppos) { struct hci_dev *hdev = file->private_data; - char buf[32]; - size_t buf_size = min(count, (sizeof(buf) - 1)); bool enable; + int err; - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - buf[buf_size] = '\0'; - if (kstrtobool(buf, &enable)) - return -EINVAL; + err = kstrtobool_from_user(user_buf, count, &enable); + if (err) + return err; if (enable == hci_dev_test_flag(hdev, HCI_FORCE_NO_MITM)) return -EALREADY; |
