summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/epautoconf.c
diff options
context:
space:
mode:
authorJustin Stitt <justinstitt@google.com>2024-03-19 02:31:53 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-26 12:44:32 +0300
commit3b5eac68995396e174e3d4d5714ad106cb13dba0 (patch)
treed3bbcd434219ea2addf20f1fb3e3aa35f4a8e221 /drivers/usb/gadget/epautoconf.c
parentc58ab9249df78bbe3561418fced5a553b68f9070 (diff)
downloadlinux-3b5eac68995396e174e3d4d5714ad106cb13dba0.tar.xz
usb: gadget: mv_u3d: replace deprecated strncpy with strscpy
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. Let's opt for the new 2-argument version of strscpy() which guarantees NUL-termination on the destination buffer and simplifies snytax. The NUL-padding behavior that strncpy() provides is not required as u3d->eps is already zero-allocated: | u3d->eps = kzalloc(size, GFP_KERNEL); Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20240318-strncpy-drivers-usb-gadget-udc-mv_u3d_core-c-v1-1-64f8dcdb7c07@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/epautoconf.c')
0 files changed, 0 insertions, 0 deletions