Re: [PATCH net-next 1/2] net: gve: convert strlcpy to strscpy

From: Catherine Sullivan
Date: Thu Mar 25 2021 - 19:58:16 EST


On Thu, Mar 25, 2021 at 1:01 AM Daode Huang <huangdaode@xxxxxxxxxx> wrote:
>
> Usage of strlcpy in linux kernel has been recently deprecated[1], so
> convert gve driver to strscpy
>
> [1] https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL
> =V6A6G1oUZcprmknw@xxxxxxxxxxxxxx/
>
> Signed-off-by: Daode Huang <huangdaode@xxxxxxxxxx>

Reviewed-by: Catherine Sullivan <csully@xxxxxxxxxx>

> ---
> drivers/net/ethernet/google/gve/gve_ethtool.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c
> index 0901fa6..e40e052 100644
> --- a/drivers/net/ethernet/google/gve/gve_ethtool.c
> +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
> @@ -14,9 +14,9 @@ static void gve_get_drvinfo(struct net_device *netdev,
> {
> struct gve_priv *priv = netdev_priv(netdev);
>
> - strlcpy(info->driver, "gve", sizeof(info->driver));
> - strlcpy(info->version, gve_version_str, sizeof(info->version));
> - strlcpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info));
> + strscpy(info->driver, "gve", sizeof(info->driver));
> + strscpy(info->version, gve_version_str, sizeof(info->version));
> + strscpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info));
> }
>
> static void gve_set_msglevel(struct net_device *netdev, u32 value)
> --
> 2.8.1
>