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

Tom Lendacky thomas.lendacky at amd.com
Fri Aug 19 08:45:29 PDT 2022


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/
> Signed-off-by: Wolfram Sang <wsa+renesas at sang-engineering.com>
> ---

> 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 at amd.com>




More information about the Linux-mediatek mailing list