mirror_ubuntu-kernels/drivers/net/ethernet/brocade/bna
Justin Stitt 460c81da66 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>
2023-10-11 17:26:14 -07:00
..
bfa_cee.c net: brocade: bna: Fix wrong function name in comments 2021-05-17 14:12:38 -07:00
bfa_cee.h
bfa_cs.h bna: Avoid clashing function prototypes 2022-11-21 08:17:59 +00:00
bfa_defs_cna.h
bfa_defs_mfg_comm.h
bfa_defs_status.h
bfa_defs.h
bfa_ioc_ct.c
bfa_ioc.c bna: replace deprecated strncpy with strscpy_pad 2023-10-11 17:26:14 -07:00
bfa_ioc.h bna: Avoid clashing function prototypes 2022-11-21 08:17:59 +00:00
bfa_msgq.c bna: remove variable num_entries 2022-10-25 19:44:59 -07:00
bfa_msgq.h bna: Avoid clashing function prototypes 2022-11-21 08:17:59 +00:00
bfi_cna.h
bfi_enet.h
bfi_reg.h
bfi.h bna: bfi.h: Avoid the use of one-element array 2020-07-22 18:12:11 -07:00
bna_enet.c bna: Avoid clashing function prototypes 2022-11-21 08:17:59 +00:00
bna_hw_defs.h net: bna: remove trailing semicolon in macro definition 2020-12-04 17:41:49 -08:00
bna_tx_rx.c bna: Avoid clashing function prototypes 2022-11-21 08:17:59 +00:00
bna_types.h bna: Avoid clashing function prototypes 2022-11-21 08:17:59 +00:00
bna.h
bnad_debugfs.c bna: Remove error checking for debugfs_create_dir() 2023-07-14 09:09:12 +01:00
bnad_ethtool.c net: bna: Fix spelling mistake "muliple" -> "multiple" 2022-09-30 13:01:16 +01:00
bnad.c net: bna: Remove unnecessary (void*) conversions 2023-07-18 19:01:07 -07:00
bnad.h
cna_fwimg.c
cna.h
Kconfig
Makefile