netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] brcm80211: use strscpy() to instead of strncpy()
@ 2022-12-23  2:37 yang.yang29
  2023-01-16 13:08 ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: yang.yang29 @ 2022-12-23  2:37 UTC (permalink / raw)
  To: aspriel
  Cc: franky.lin, hante.meuleman, kvalo, davem, edumazet, kuba, pabeni,
	linux-wireless, brcm80211-dev-list.pdl, sha-cyfmac-dev-list,
	netdev, linux-kernel, xu.panda, yang.yang29

From: Xu Panda <xu.panda@zte.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@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] brcm80211: use strscpy() to instead of strncpy()
  2022-12-23  2:37 [PATCH net-next] brcm80211: use strscpy() to instead of strncpy() yang.yang29
@ 2023-01-16 13:08 ` Kalle Valo
  2023-01-16 13:31   ` Leon Romanovsky
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2023-01-16 13:08 UTC (permalink / raw)
  To: yang.yang29
  Cc: aspriel, franky.lin, hante.meuleman, davem, edumazet, kuba,
	pabeni, linux-wireless, brcm80211-dev-list.pdl,
	sha-cyfmac-dev-list, netdev, linux-kernel, xu.panda, yang.yang29

<yang.yang29@zte.com.cn> wrote:

> From: Xu Panda <xu.panda@zte.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@zte.com.cn>
> Signed-off-by: Yang Yang <yang.yang29@zte.com>

Mismatch email in From and Signed-off-by lines:

From: <yang.yang29@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/202212231037210142246@zte.com.cn/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] brcm80211: use strscpy() to instead of strncpy()
  2023-01-16 13:08 ` Kalle Valo
@ 2023-01-16 13:31   ` Leon Romanovsky
  2023-01-16 15:18     ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2023-01-16 13:31 UTC (permalink / raw)
  To: Kalle Valo
  Cc: yang.yang29, aspriel, franky.lin, hante.meuleman, davem, edumazet,
	kuba, pabeni, linux-wireless, brcm80211-dev-list.pdl,
	sha-cyfmac-dev-list, netdev, linux-kernel, xu.panda

On Mon, Jan 16, 2023 at 01:08:36PM +0000, Kalle Valo wrote:
> <yang.yang29@zte.com.cn> wrote:
> 
> > From: Xu Panda <xu.panda@zte.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@zte.com.cn>
> > Signed-off-by: Yang Yang <yang.yang29@zte.com>
> 
> Mismatch email in From and Signed-off-by lines:
> 
> From: <yang.yang29@zte.com.cn>
> Signed-off-by: Yang Yang <yang.yang29@zte.com>
> 
> Patch set to Changes Requested.

Kalle, please be aware of this response
https://lore.kernel.org/netdev/20230113112817.623f58fa@kernel.org/

"I don't trust that you know what you're doing. So please don't send
any more strncpy() -> strscpy() conversions for networking."

Thanks

> 
> -- 
> https://patchwork.kernel.org/project/linux-wireless/patch/202212231037210142246@zte.com.cn/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] brcm80211: use strscpy() to instead of strncpy()
  2023-01-16 13:31   ` Leon Romanovsky
@ 2023-01-16 15:18     ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-01-16 15:18 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: yang.yang29, aspriel, franky.lin, hante.meuleman, davem, edumazet,
	kuba, pabeni, linux-wireless, brcm80211-dev-list.pdl,
	sha-cyfmac-dev-list, netdev, linux-kernel, xu.panda

Leon Romanovsky <leon@kernel.org> writes:

> On Mon, Jan 16, 2023 at 01:08:36PM +0000, Kalle Valo wrote:
>> <yang.yang29@zte.com.cn> wrote:
>> 
>> > From: Xu Panda <xu.panda@zte.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@zte.com.cn>
>> > Signed-off-by: Yang Yang <yang.yang29@zte.com>
>> 
>> Mismatch email in From and Signed-off-by lines:
>> 
>> From: <yang.yang29@zte.com.cn>
>> Signed-off-by: Yang Yang <yang.yang29@zte.com>
>> 
>> Patch set to Changes Requested.
>
> Kalle, please be aware of this response
> https://lore.kernel.org/netdev/20230113112817.623f58fa@kernel.org/
>
> "I don't trust that you know what you're doing. So please don't send
> any more strncpy() -> strscpy() conversions for networking."

Good to know, thanks.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-16 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-23  2:37 [PATCH net-next] brcm80211: use strscpy() to instead of strncpy() yang.yang29
2023-01-16 13:08 ` Kalle Valo
2023-01-16 13:31   ` Leon Romanovsky
2023-01-16 15:18     ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).