Re: [PATCH net-next] drivers/net/ethernet/qualcomm/emac: Use strscpy() to copy the ethtool strings

From
Timur Tabi <timur@kernel.org>
Date
2026-06-09 15:09:27
Also in
linux-hardening, lkml
Reply to
unknown sender, 2026-06-08
On Mon, Jun 8, 2026 at 4:55 AM [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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;
It would be better to replace this with a call to ethtool_sprintf(),
which already takes ETH_GSTRING_LEN into account.  And may as well
update the ETH_SS_STATS case underneath it.
        case ETH_SS_STATS:
--
2.39.5
Thread (4 messages) 4 messages, 2 authors, 2026-06-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help