linux/drivers/infiniband/hw/qib
Justin Stitt cb7ab7854b IB/qib: Replace deprecated strncpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1]
and as such we should prefer more robust and less ambiguous string
interfaces.

We know `txselect_list` is expected to be NUL-terminated based on its
use in `param_get_string()`:
| int param_get_string(char *buffer, const struct kernel_param *kp)
| {
| 	const struct kparam_string *kps = kp->str;
| 	return scnprintf(buffer, PAGE_SIZE, "%s\n", kps->string);
| }

Note that `txselect_list` is assigned to `kp_txselect`'s string field:
| static struct kparam_string kp_txselect = {
| 	.string = txselect_list,
| 	.maxlen = MAX_ATTEN_LEN
| };

Wherein it is then assigned the set and get methods:
| module_param_call(txselect, setup_txselect, param_get_string,
| 		  &kp_txselect, S_IWUSR | S_IRUGO);

Considering the above, a suitable replacement is `strscpy` [2] due to
the fact that it guarantees NUL-termination on the destination buffer
without unnecessarily NUL-padding.

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>
Link: https://lore.kernel.org/r/20230921-strncpy-drivers-infiniband-hw-qib-qib_iba7322-c-v1-1-373727763f5b@google.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2023-09-22 13:29:19 +03:00
..
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
qib_6120_regs.h
qib_7220_regs.h
qib_7220.h
qib_7322_regs.h
qib_common.h RDMA: Delete not-used static inline functions 2021-03-22 09:31:19 -03:00
qib_debugfs.c
qib_debugfs.h
qib_diag.c
qib_driver.c IB/qib: Rebranding of qib driver to Cornelis Networks 2021-10-29 13:30:43 -03:00
qib_eeprom.c RDMA/hw/qib/qib_eeprom: Fix misspelling of 'buff' in 'qib_eeprom_{read,write}()' 2021-01-22 14:37:30 -04:00
qib_file_ops.c RDMA: Make all 'class' structures const 2023-08-08 13:25:15 +03:00
qib_fs.c infiniband: convert to ctime accessor functions 2023-07-13 10:28:02 +02:00
qib_iba6120.c v6.2 merge window pull request 2022-12-14 09:27:13 -08:00
qib_iba7220.c IB/qib: Fix repeated "in" within comments 2022-07-28 12:50:05 -03:00
qib_iba7322.c IB/qib: Replace deprecated strncpy 2023-09-22 13:29:19 +03:00
qib_init.c RDMA/qib: don't pass bogus GFP_ flags to dma_alloc_coherent 2022-11-21 09:36:05 +01:00
qib_intr.c RDMA/hw/qib/qib_intr: Fix a bunch of formatting issues 2021-01-22 14:37:31 -04:00
qib_mad.c RDMA: Support more than 255 rdma ports 2021-03-26 09:31:21 -03:00
qib_mad.h
qib_pcie.c IB/qib: Drop redundant pci_enable_pcie_error_reporting() 2023-03-19 16:16:06 +02:00
qib_pio_copy.c
qib_qp.c RDMA: Support more than 255 rdma ports 2021-03-26 09:31:21 -03:00
qib_qsfp.c
qib_qsfp.h
qib_rc.c RDMA/hw/qib/qib_rc: Fix some worthy kernel-docs demote hardly complete one 2021-01-22 14:37:31 -04:00
qib_ruc.c
qib_sd7220.c IB: Fix spelling of 'writable' 2022-07-04 10:14:57 -03:00
qib_sdma.c RDMA/qib: Convert tasklets to use new tasklet_setup() API 2020-09-03 12:01:53 -03:00
qib_sysfs.c IB/qib: Fix duplicate sysfs directory name 2022-02-17 11:54:08 -04:00
qib_twsi.c RDMA/hw/qib/qib_twsi: Provide description for missing param 'last' 2021-01-22 14:37:32 -04:00
qib_tx.c RDMA/qib: Remove not-used variable n 2022-10-24 14:24:57 +03:00
qib_uc.c RDMA/hw/qib/qib_uc: Provide description for missing 'flags' param 2021-01-22 14:37:32 -04:00
qib_ud.c RDMA/hw/qib/qib_ud: Provide description for 'qib_make_ud_req's 'flags' param 2021-01-22 14:37:33 -04:00
qib_user_pages.c mm/gup: remove vmas parameter from pin_user_pages() 2023-06-09 16:25:26 -07:00
qib_user_sdma.c RDMA/qib: Remove deprecated kmap() call 2023-03-19 11:35:53 +02:00
qib_user_sdma.h
qib_verbs.c RDMA/qib: rename copy_io to qib_copy_io 2021-11-29 06:41:29 -07:00
qib_verbs.h RDMA: Support more than 255 rdma ports 2021-03-26 09:31:21 -03:00
qib_wc_ppc64.c
qib_wc_x86_64.c
qib.h IB: Fix repeated words 'the the' comments 2022-07-22 12:02:29 -03:00