Thread (1 message) flat view 1 message, 1 author, 2022-08-19

Re: [PATCH] net: move from strlcpy with unused retval to strscpy

From: Tom Lendacky via Virtualization <hidden>
Date: 2022-08-19 23:29:59
Also in: intel-wired-lan, linux-mediatek, linux-sunxi, linuxppc-dev

On 8/18/22 16:00, Wolfram Sang wrote:
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ (local)
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
quoted hunk
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 6ceb1cdf6eba..6e83ff59172a 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -402,8 +402,8 @@ static void xgbe_get_drvinfo(struct net_device *netdev,
  	struct xgbe_prv_data *pdata = netdev_priv(netdev);
  	struct xgbe_hw_features *hw_feat = &pdata->hw_feat;
  
-	strlcpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver));
-	strlcpy(drvinfo->bus_info, dev_name(pdata->dev),
+	strscpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver));
+	strscpy(drvinfo->bus_info, dev_name(pdata->dev),
  		sizeof(drvinfo->bus_info));
  	snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d",
  		 XGMAC_GET_BITS(hw_feat->version, MAC_VR, USERVER),
For drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help