aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/macsec.c
diff options
context:
space:
mode:
authorJustin Stitt <justinstitt@google.com>2023-10-09 17:45:33 +0000
committerJakub Kicinski <kuba@kernel.org>2023-10-11 17:26:14 -0700
commit460c81da66f2258e504a547ea0e4facf5ed90903 (patch)
tree8d1a7e227084e0f003fdea9e8ab130fe7da247d9 /drivers/net/macsec.c
parentnet: dsa: lantiq_gswip: replace deprecated strncpy with ethtool_sprintf (diff)
downloadwireguard-linux-460c81da66f2258e504a547ea0e4facf5ed90903.tar.xz
wireguard-linux-460c81da66f2258e504a547ea0e4facf5ed90903.zip
bna: replace deprecated strncpy with strscpy_pad
`strncpy` is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. bfa_ioc_get_adapter_manufacturer() simply copies a string literal into `manufacturer`. Another implementation of bfa_ioc_get_adapter_manufacturer() from drivers/scsi/bfa/bfa_ioc.c uses memset + strscpy: | void | bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, char *manufacturer) | { | memset((void *)manufacturer, 0, BFA_ADAPTER_MFG_NAME_LEN); | strscpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); | } Let's use `strscpy_pad` to eliminate some redundant work while still NUL-terminating and NUL-padding the destination buffer. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://github.com/KSPP/linux/issues/90 Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20231009-strncpy-drivers-net-ethernet-brocade-bna-bfa_ioc-c-v2-1-78e0f47985d3@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/macsec.c')
0 files changed, 0 insertions, 0 deletions