NFC: nfcmrvl: Replace strcpy() with strscpy()
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 NFC: nfcmrvl: Replace strcpy() with strscpy()
From: Tomasz Unger <[email protected]>
Replace strcpy() with strscpy() which limits the copy to the size of the destination buffer. Since fw_dnld->name is an array, the two-argument variant of strscpy() is used - the compiler deduces the buffer size automatically.
This is a defensive cleanup replacing the deprecated strcpy() with the preferred strscpy().
---
Testing:
- checkpatch.pl: 0 errors, 0 warnings
- make M=drivers/nfc/nfcmrvl/: compiled successfully, 0 errors, 0 warnings
- Module loaded successfully in QEMU (x86_64) with buildroot:
modprobe nfcmrvl - no errors, confirmed via lsmod
drivers/nfc/nfcmrvl/fw_dnld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/nfcmrvl/fw_dnld.c +1 -1
@@ -492,7 +492,7 @@ int nfcmrvl_fw_dnld_start(struct nci_dev *ndev, const char *firmware_name)if (!firmware_name || !firmware_name[0 ])return -EINVAL ; -strcpy (fw_dnld->name, firmware_name); +strscpy (fw_dnld->name, firmware_name);/* * Retrieve FW binary file and parse it to initialize FW download
Signature · 1 line
2.53.0
Quoted 11 lines · On Sun, Mar 01, 2026 at 03:43:45PM +0100, [email protected] wrote:
From: Tomasz Unger <[email protected]>
Replace
strcpy()withstrscpy()which limits the copy to the size of the destination buffer. Sincefw_dnld->nameis an array, the two-argument variant ofstrscpy()is used - the compiler deduces the buffer size automatically.This is a defensive cleanup replacing the deprecated
strcpy()with the preferredstrscpy().Signed-off-by Tomasz Unger <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sun, 1 Mar 2026 15:43:45 +0100 you wrote:
From: Tomasz Unger <[email protected]>
Replace
strcpy()withstrscpy()which limits the copy to the size of the destination buffer. Sincefw_dnld->nameis an array, the two-argument variant ofstrscpy()is used - the compiler deduces the buffer size automatically.[...]
Here is the summary with links:
- [net-next,v1] NFC: nfcmrvl: Replace strcpy() with strscpy()
https://git.kernel.org/netdev/net-next/c/c49a9eb650d5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html