Skip to contentSkip to conversation

net: qualcomm: emac: replace strcpy() with strscpy()

PATCH In review Hungyu Lin 2 participants 3 messages Jun 7 – Jun 10

Subsystems (3)
lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

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
index f502db9cdea9..ffc300641aac 100644
@@ -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
maintainer
#1 lore raw
Quoted 4 lines · 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

author
#2 lore raw
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