The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] net: qualcomm: emac: replace strcpy() with strscpy()
@ 2026-06-07 15:44 Hungyu Lin
  2026-06-10  1:39 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Hungyu Lin @ 2026-06-07 15:44 UTC (permalink / raw)
  To: timur, netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, linux-kernel,
	Hungyu Lin

Replace strcpy() with strscpy() in emac_get_strings().

strscpy() is the preferred string copy helper in the kernel and
provides better bounds checking semantics.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 drivers/net/ethernet/qualcomm/emac/emac-ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
index f502db9cdea9..ffc300641aac 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
@@ -95,7 +95,7 @@ static void emac_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 
 	switch (stringset) {
 	case ETH_SS_PRIV_FLAGS:
-		strcpy(data, "single-pause-mode");
+		strscpy(data, "single-pause-mode", ETH_GSTRING_LEN);
 		break;
 
 	case ETH_SS_STATS:
-- 
2.34.1


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

* Re: [PATCH] net: qualcomm: emac: replace strcpy() with strscpy()
  2026-06-07 15:44 [PATCH] net: qualcomm: emac: replace strcpy() with strscpy() Hungyu Lin
@ 2026-06-10  1:39 ` Jakub Kicinski
  2026-06-10  3:33   ` Hungyu Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2026-06-10  1:39 UTC (permalink / raw)
  To: Hungyu Lin
  Cc: timur, netdev, andrew+netdev, davem, edumazet, pabeni,
	linux-kernel

On Sun,  7 Jun 2026 15:44:23 +0000 Hungyu Lin wrote:
> Replace strcpy() with strscpy() in emac_get_strings().
> 
> strscpy() is the preferred string copy helper in the kernel and
> provides better bounds checking semantics.

strcpy() on a literal falls under pointless cleanups, IMO:

Quoting documentation:

  Clean-up patches
  ~~~~~~~~~~~~~~~~
  
  Netdev discourages patches which perform simple clean-ups, which are not in
  the context of other work. For example:
  
  * Addressing ``checkpatch.pl``, and other trivial coding style warnings
  * Addressing :ref:`Local variable ordering<rcs>` issues
  * Conversions to device-managed APIs (``devm_`` helpers)
  
  This is because it is felt that the churn that such changes produce comes
  at a greater cost than the value of such clean-ups.
  
  Conversely, spelling and grammar fixes are not discouraged.
  
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#clean-up-patches

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

* Re: [PATCH] net: qualcomm: emac: replace strcpy() with strscpy()
  2026-06-10  1:39 ` Jakub Kicinski
@ 2026-06-10  3:33   ` Hungyu Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Hungyu Lin @ 2026-06-10  3:33 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: timur, netdev, andrew+netdev, davem, edumazet, pabeni,
	linux-kernel

>   Netdev discourages patches which perform simple clean-ups, which are not in
>   the context of other work. For example:
>
>   * Addressing ``checkpatch.pl``, and other trivial coding style warnings
>   * Addressing :ref:`Local variable ordering<rcs>` issues
>   * Conversions to device-managed APIs (``devm_`` helpers)
>
>   This is because it is felt that the churn that such changes produce comes
>   at a greater cost than the value of such clean-ups.
>
>   Conversely, spelling and grammar fixes are not discouraged.
>
> See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#clean-up-patches

Thanks for the review.

Understood, I'll keep the netdev cleanup policy in
mind for future submissions.

Thanks,
Hungyu

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

end of thread, other threads:[~2026-06-10  3:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-07 15:44 [PATCH] net: qualcomm: emac: replace strcpy() with strscpy() Hungyu Lin
2026-06-10  1:39 ` Jakub Kicinski
2026-06-10  3:33   ` Hungyu Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox