wifi: mwifiex: prefer strscpy() over strlcpy()
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 29 Jun 2023 08:51:00 +0000 (11:51 +0300)
committerKalle Valo <kvalo@kernel.org>
Tue, 25 Jul 2023 15:14:06 +0000 (18:14 +0300)
Prefer 'strscpy()' over 'strlcpy()' in 'mwifiex_init_hw_fw()'.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230629085115.180499-1-dmantipov@yandex.ru
drivers/net/wireless/marvell/mwifiex/main.c

index 1cd9d20..d99127d 100644 (file)
@@ -724,14 +724,9 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter,
        /* Override default firmware with manufacturing one if
         * manufacturing mode is enabled
         */
-       if (mfg_mode) {
-               if (strlcpy(adapter->fw_name, MFG_FIRMWARE,
-                           sizeof(adapter->fw_name)) >=
-                           sizeof(adapter->fw_name)) {
-                       pr_err("%s: fw_name too long!\n", __func__);
-                       return -1;
-               }
-       }
+       if (mfg_mode)
+               strscpy(adapter->fw_name, MFG_FIRMWARE,
+                       sizeof(adapter->fw_name));
 
        if (req_fw_nowait) {
                ret = request_firmware_nowait(THIS_MODULE, 1, adapter->fw_name,