]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFC: nfcmrvl: Replace strcpy() with strscpy()
authorTomasz Unger <tomasz.unger@yahoo.pl>
Sun, 1 Mar 2026 14:43:45 +0000 (15:43 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 4 Mar 2026 01:13:11 +0000 (17:13 -0800)
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().

Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260301144345.218628-1-tomasz.unger@yahoo.pl
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/nfc/nfcmrvl/fw_dnld.c

index a9b03dcc410067ace4a4537d7882465ff7310d0c..2b8f401d8fd7a69862824c6fa66b1d60dc26497f 100644 (file)
@@ -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