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

From: Krzysztof Hałasa
Date: Tue Aug 23 2022 - 03:10:03 EST


Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> writes:

> 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.

Looks good to me (IXP4xx Ethernet).
Acked-by: Krzysztof Hałasa <khalasa@xxxxxxx>

> +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
> @@ -999,11 +999,11 @@ static void ixp4xx_get_drvinfo(struct net_device *dev,
> {
> struct port *port = netdev_priv(dev);
>
> - strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
> + strscpy(info->driver, DRV_NAME, sizeof(info->driver));
> snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u",
> port->firmware[0], port->firmware[1],
> port->firmware[2], port->firmware[3]);
> - strlcpy(info->bus_info, "internal", sizeof(info->bus_info));
> + strscpy(info->bus_info, "internal", sizeof(info->bus_info));
> }
>

--
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa