Thread (1 message) 1 message, 1 author, 2022-08-23

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

From: Krzysztof Hałasa <khalasa@piap.pl>
Date: 2022-08-23 07:10:03
Also in: linux-arm-kernel, lkml

Wolfram Sang [off-list ref] 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@piap.pl>
quoted hunk
+++ 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help