OSDN Git Service

net: lantiq_etop: replace strlcpy with strscpy
authorAleksander Jan Bajkowski <olek2@wp.pl>
Wed, 29 Dec 2021 23:22:57 +0000 (00:22 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Dec 2021 13:20:22 +0000 (13:20 +0000)
strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

This silences the related checkpatch warnings from:
commit 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy")

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/lantiq_etop.c

index 1f6808b..7608506 100644 (file)
@@ -306,9 +306,9 @@ ltq_etop_hw_init(struct net_device *dev)
 static void
 ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       strlcpy(info->driver, "Lantiq ETOP", sizeof(info->driver));
-       strlcpy(info->bus_info, "internal", sizeof(info->bus_info));
-       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strscpy(info->driver, "Lantiq ETOP", sizeof(info->driver));
+       strscpy(info->bus_info, "internal", sizeof(info->bus_info));
+       strscpy(info->version, DRV_VERSION, sizeof(info->version));
 }
 
 static const struct ethtool_ops ltq_etop_ethtool_ops = {