diff mbox series

[1/3,v4] wifi: mwifiex: prefer strscpy() over strlcpy()

Message ID 20230629085115.180499-1-dmantipov@yandex.ru (mailing list archive)
State Accepted
Commit caf9ead2c7d06fd7aa4cb48bd569ad61db9a0b4a
Delegated to: Kalle Valo
Headers show
Series [1/3,v4] wifi: mwifiex: prefer strscpy() over strlcpy() | expand

Commit Message

Dmitry Antipov June 29, 2023, 8:51 a.m. UTC
Prefer 'strscpy()' over 'strlcpy()' in 'mwifiex_init_hw_fw()'.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v4: simplify to drop strlcpy() only (Brian Norris)
---
 drivers/net/wireless/marvell/mwifiex/main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Brian Norris June 29, 2023, 7:50 p.m. UTC | #1
On Thu, Jun 29, 2023 at 11:51:00AM +0300, Dmitry Antipov wrote:
> Prefer 'strscpy()' over 'strlcpy()' in 'mwifiex_init_hw_fw()'.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
> v4: simplify to drop strlcpy() only (Brian Norris)

Reviewed-by: Brian Norris <briannorris@chromium.org>
Kalle Valo July 25, 2023, 3:14 p.m. UTC | #2
Dmitry Antipov <dmantipov@yandex.ru> wrote:

> Prefer 'strscpy()' over 'strlcpy()' in 'mwifiex_init_hw_fw()'.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> Reviewed-by: Brian Norris <briannorris@chromium.org>

2 patches applied to wireless-next.git, thanks.

caf9ead2c7d0 wifi: mwifiex: prefer strscpy() over strlcpy()
dcce94b80a95 wifi: mwifiex: fix fortify warning
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index ea22a08e6c08..64512b00e8b5 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -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,