diff options
author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-03-20 17:56:44 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-11 16:08:33 +0200 |
commit | bd3cf1a9396e6efe178ddbd92c3747a4cf820a4e (patch) | |
tree | cb1e586ba504a8661fed7cea202c87b716c39c68 /drivers/usb/cdns3/cdns3-plat.c | |
parent | 6e07dd1354f4173f52a5a29e47ba6d0f32e70c6e (diff) |
USB: gadget: Replace deprecated strncpy() with strscpy()
strncpy() is deprecated for NUL-terminated destination buffers; use
strscpy() instead. Since kzalloc() already zeroes out the destination
buffer, the potential NUL-padding by strncpy() is unnecessary. strscpy()
copies only the required characters and guarantees NUL-termination.
Since the destination buffer has a fixed length, strscpy() automatically
determines its size using sizeof() when the argument is omitted. This
makes an explicit sizeof() call unnecessary.
The source string is also NUL-terminated and meets the __must_be_cstr()
requirement of strscpy().
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250320165647.34859-2-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-plat.c')
0 files changed, 0 insertions, 0 deletions