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

Wolfram Sang posted 1 patch 3 years, 7 months ago
drivers/w1/masters/sgi_w1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] w1: move from strlcpy with unused retval to strscpy
Posted by Wolfram Sang 3 years, 7 months ago
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@sang-engineering.com>
---
 drivers/w1/masters/sgi_w1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/masters/sgi_w1.c b/drivers/w1/masters/sgi_w1.c
index e8c7fa68d3cc..d7fbc3c146e1 100644
--- a/drivers/w1/masters/sgi_w1.c
+++ b/drivers/w1/masters/sgi_w1.c
@@ -93,7 +93,7 @@ static int sgi_w1_probe(struct platform_device *pdev)
 
 	pdata = dev_get_platdata(&pdev->dev);
 	if (pdata) {
-		strlcpy(sdev->dev_id, pdata->dev_id, sizeof(sdev->dev_id));
+		strscpy(sdev->dev_id, pdata->dev_id, sizeof(sdev->dev_id));
 		sdev->bus_master.dev_id = sdev->dev_id;
 	}
 
-- 
2.35.1
Re: [PATCH] w1: move from strlcpy with unused retval to strscpy
Posted by Krzysztof Kozlowski 2 years, 11 months ago
On Thu, 18 Aug 2022 23:01:21 +0200, 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.
> 
> 

Applied, thanks!

[1/1] w1: move from strlcpy with unused retval to strscpy
      https://git.kernel.org/krzk/linux-w1/c/5dfd3c73ff81618fee0ef682b6fd7779863f41e4

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>