diff options
author | Justin Stitt <justinstitt@google.com> | 2023-09-30 19:05:07 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-09-30 19:24:15 +0300 |
commit | 96609688ab8a8ec25c4eeced53e88e26cff4fb06 (patch) | |
tree | 59c99d6238d621c472b974abe7216cb958885bba /drivers/input/rmi4 | |
parent | c50fdc48643a25f5218f6b8bba4f28e1b4a94708 (diff) | |
download | linux-96609688ab8a8ec25c4eeced53e88e26cff4fb06.tar.xz |
Input: synaptics-rmi4 - replace deprecated strncpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1]
Let's use memcpy() as the bounds have already been checked and this
decays into a simple byte copy from one buffer to another removing any
ambiguity that strncpy has.
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230921-strncpy-drivers-input-rmi4-rmi_f34-c-v1-1-4aef2e84b8d2@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/rmi4')
-rw-r--r-- | drivers/input/rmi4/rmi_f34.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c index 0d9a5756e3f5..3b3ac71e53dc 100644 --- a/drivers/input/rmi4/rmi_f34.c +++ b/drivers/input/rmi4/rmi_f34.c @@ -471,7 +471,7 @@ static ssize_t rmi_driver_update_fw_store(struct device *dev, if (buf[count - 1] == '\0' || buf[count - 1] == '\n') copy_count -= 1; - strncpy(fw_name, buf, copy_count); + memcpy(fw_name, buf, copy_count); fw_name[copy_count] = '\0'; ret = request_firmware(&fw, fw_name, dev); |