diff options
author | Justin Stitt <justinstitt@google.com> | 2023-09-30 09:32:31 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-09-30 09:35:31 -0700 |
commit | 68ede283a1d8fe0813b218aeb498faf3b0fc0a7b (patch) | |
tree | bc27c779cf539fb8be725dfe406aede738a3777d /samples/auxdisplay | |
parent | 348cbf987ed328682af7d74ce98d9f0e6857f42f (diff) |
Input: axp20x-pek - avoid needless newline removal
This code is doing more work than it needs to.
Before handing off `val_str` to `kstrtouint()` we are eagerly removing
any trailing newline which requires copying `buf`, validating it's
length and checking/replacing any potential newlines.
kstrtouint() handles this implicitly:
kstrtouint ->
kstrotoull -> (documentation)
| /**
| * kstrtoull - convert a string to an unsigned long long
| * @s: The start of the string. The string must be null-terminated, and may also
| * include a single newline before its terminating null. The first character
| ...
Let's remove the redundant functionality and let kstrtouint handle it.
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230925-strncpy-drivers-input-misc-axp20x-pek-c-v2-1-ff7abe8498d6@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'samples/auxdisplay')
0 files changed, 0 insertions, 0 deletions