kprobes: Use helper to parse boolean input from userspace
authorPunit Agrawal <punitagrawal@gmail.com>
Tue, 14 Sep 2021 14:38:46 +0000 (23:38 +0900)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 1 Oct 2021 01:24:04 +0000 (21:24 -0400)
commit5d6de7d7fb4b0f752adff80ca003b4fd4b467b64
tree60d15a4284316f5e38b2bb2ed7caeecf9a1e857c
parent8f7262cd66699a4b02eb7549b35c81b2116aad95
kprobes: Use helper to parse boolean input from userspace

The "enabled" file provides a debugfs interface to arm / disarm
kprobes in the kernel. In order to parse the buffer containing the
values written from userspace, the callback manually parses the user
input to convert it to a boolean value.

As taking a string value from userspace and converting it to boolean
is a common operation, a helper kstrtobool_from_user() is already
available in the kernel. Update the callback to use the common helper
to parse the write buffer from userspace.

Link: https://lkml.kernel.org/r/163163032637.489837.10678039554832855327.stgit@devnote2
Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/kprobes.c