net: qualcomm: emac: replace strcpy() with strscpy()
Subsystems (3)
PATCH 1/1 net: qualcomm: emac: replace strcpy() with strscpy()
Replace strcpy() with strscpy() in emac_get_strings().
strscpy() is the preferred string copy helper in the kernel and provides better bounds checking semantics.
--- drivers/net/ethernet/qualcomm/emac/emac-ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qualcomm/emac/emac-ethtool.c +1 -1
@@ -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 :
Signature · 1 line
2.34.1
Jakub Kicinski
maintainerQuoted 4 lines · On Sun, 7 Jun 2026 15:44:23 +0000 Hungyu Lin wrote:
Replace
strcpy()withstrscpy()inemac_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
Quoted 7 lines
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)
Quoted 6 lines
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