NFC: s3fwrn5: Replace strcpy() with strscpy()
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 NFC: s3fwrn5: 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_info->fw_name is an array with a fixed, declared size, 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().
---
Changes since v2:
- Fixed commit message line wrapping (Krzysztof Kozlowski)
- Added Reviewed-by tag from Krzysztof Kozlowski
Changes since v1:
- Clarified commit message: fw_info->fw_name described as "an array with a fixed, declared size" as requested by Krzysztof Kozlowski <[email protected]>
drivers/nfc/s3fwrn5/firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/s3fwrn5/firmware.c +1 -1
@@ -454,7 +454,7 @@ void s3fwrn5_fw_init(struct s3fwrn5_fw_info *fw_info, const char *fw_name) fw_info->parity =0x00 ; fw_info->rsp =NULL ; fw_info->fw.fw =NULL ; -strcpy (fw_info->fw_name, fw_name); +strscpy (fw_info->fw_name, fw_name);init_completion (&fw_info->completion); }
Signature · 1 line
2.53.0
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 Mon, 2 Mar 2026 11:09:08 +0100 you wrote:
From: Tomasz Unger <[email protected]>
Replace
strcpy()withstrscpy()which limits the copy to the size of the destination buffer. Sincefw_info->fw_nameis an array with a fixed, declared size, the two-argument variant ofstrscpy()is used - the compiler deduces the buffer size automatically.[...]
Here is the summary with links:
- [net-next,v3] NFC: s3fwrn5: Replace strcpy() with strscpy()
https://git.kernel.org/netdev/net-next/c/8ce185c7e00d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html