Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFC: s3fwrn5: Replace strcpy() with strscpy()

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().

Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260302100908.26399-1-tomasz.unger@yahoo.pl
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Tomasz Unger and committed by
Jakub Kicinski
8ce185c7 c49a9eb6

+1 -1
+1 -1
drivers/nfc/s3fwrn5/firmware.c
··· 454 454 fw_info->parity = 0x00; 455 455 fw_info->rsp = NULL; 456 456 fw_info->fw.fw = NULL; 457 - strcpy(fw_info->fw_name, fw_name); 457 + strscpy(fw_info->fw_name, fw_name); 458 458 init_completion(&fw_info->completion); 459 459 } 460 460