[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202212231037210142246@zte.com.cn>
Date: Fri, 23 Dec 2022 10:37:21 +0800 (CST)
From: <yang.yang29@....com.cn>
To: <aspriel@...il.com>
Cc: <franky.lin@...adcom.com>, <hante.meuleman@...adcom.com>,
<kvalo@...nel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>,
<linux-wireless@...r.kernel.org>,
<brcm80211-dev-list.pdl@...adcom.com>,
<sha-cyfmac-dev-list@...ineon.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <xu.panda@....com.cn>,
<yang.yang29@....com.cn>
Subject: [PATCH net-next] brcm80211: use strscpy() to instead of strncpy()
From: Xu Panda <xu.panda@....com.cn>
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL-terminated strings.
Signed-off-by: Xu Panda <xu.panda@....com.cn>
Signed-off-by: Yang Yang <yang.yang29@....com>
---
drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c
index b7df576bb84d..66336c87b0d9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c
@@ -584,8 +584,7 @@ struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc,
rxextheadroom, nrxpost, rxoffset, txregbase, rxregbase);
/* make a private copy of our callers name */
- strncpy(di->name, name, MAXNAMEL);
- di->name[MAXNAMEL - 1] = '\0';
+ strscpy(di->name, name, MAXNAMEL);
di->dmadev = core->dma_dev;
--
2.15.2
Powered by blists - more mailing lists