[PATCH 10/18] brcmsmac: change strncpy+truncation to strlcpy

Subsystems: broadcom brcm80211 ieee802.11 wireless drivers, the rest

STALE2706d

2 messages, 2 authors, 2018-07-13 · open the first message on its own page

[PATCH 10/18] brcmsmac: change strncpy+truncation to strlcpy

From: Dominique Martinet <asmadeus@codewreck.org>
Date: 2018-07-13 01:25:53

Generated by scripts/coccinelle/misc/strncpy_truncation.cocci

Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---

Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the
first patch of the serie) for the motivation behind this patch

 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..58ccd72d672c 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';
+	strlcpy(di->name, name, MAXNAMEL);
 
 	di->dmadev = core->dma_dev;
 
-- 
2.17.1

Re: [PATCH 10/18] brcmsmac: change strncpy+truncation to strlcpy

From: Arend van Spriel <arend.vanspriel@broadcom.com>
Date: 2018-07-13 07:19:41

On 7/13/2018 3:25 AM, Dominique Martinet wrote:
Generated by scripts/coccinelle/misc/strncpy_truncation.cocci
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---

Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the
first patch of the serie) for the motivation behind this patch
I would prefer to have the motivation in the commit message of this patch.

Regards,
Arend
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help