Skip to contentSkip to conversation

drm: apple: use strscpy() in place of strlcpy()

PATCH In review Arnd Bergmann 2 participants 2 messages Jan 22, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: apple: use strscpy() in place of strlcpy()

From: Arnd Bergmann <[email protected]>

Since commit d26270061ae6 ("string: Remove strlcpy()"), the strlcpy() function causes a build failure.

Since the return value is ignored, changing it to the strscpy() causes no change in behavior but fixes the build failure.

Fixes f237c83e4302 ("drm: apple: DCP AFK/EPIC support")

---
The apple drm driver is not in mainline linux yet, this patch is against https://github.com/AsahiLinux/linux/tree/bits/200-dcp

---
 drivers/gpu/drm/apple/afk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/apple/afk.c +1 -1
index 99d579d5ce47..9fbcd18878e8 100644
@@ -236,7 +236,7 @@ static void afk_recv_handle_init(struct apple_dcp_afkep *ep, u32 channel,
 		return;
 	}
 
-	strlcpy(name, payload, sizeof(name));
+	strscpy(name, payload, sizeof(name));
 
 	/*
 	 * in DCP firmware 13.2 DCP reports interface-name as name which starts
Signature · 1 line
2.39.2
#1 lore raw

Hej,

Quoted 30 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Since commit d26270061ae6 ("string: Remove strlcpy()"), the strlcpy() function causes a build failure.

Since the return value is ignored, changing it to the strscpy() causes no change in behavior but fixes the build failure.

Fixes f237c83e4302 ("drm: apple: DCP AFK/EPIC support")

---
The apple drm driver is not in mainline linux yet, this patch is against https://github.com/AsahiLinux/linux/tree/bits/200-dcp

---
 drivers/gpu/drm/apple/afk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/apple/afk.c +1 -1
index 99d579d5ce47..9fbcd18878e8 100644
@@ -236,7 +236,7 @@ static void afk_recv_handle_init(struct 
 apple_dcp_afkep *ep, u32 channel,
 		return;
 	}
 
-	strlcpy(name, payload, sizeof(name));
+	strscpy(name, payload, sizeof(name));
 
 	/*
Quoted 1 line

* in DCP firmware 13.2 DCP reports interface-name as name which starts

thanks, patch included in my dev branch and will be in the next pull request I'll send to Hector.

best regards,
Janne