summaryrefslogtreecommitdiff
blob: 2449d28833468e6d5535da85ad2513910ae69903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Bug: https://bugs.gentoo.org/926829
Patch from Christian Bricart to remove strlcpy and replace with strscpy
so this builds with linux kernels =>6.8.

Signed-Off-By: Jay Faulkner <jay@jvf.cc>

diff -Naur r8152-2.17.1/compatibility.h r8152-2.17.1.patched/compatibility.h
--- r8152-2.17.1/compatibility.h	2024-03-12 09:43:05.150688533 +0100
+++ r8152-2.17.1.patched/compatibility.h	2024-03-12 09:46:20.913759268 +0100
@@ -18,6 +18,10 @@
 #include <net/gso.h>
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
+#define strscpy strlcpy
+#endif
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
 	#include <linux/mdio.h>
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
diff -Naur r8152-2.17.1/r8152.c r8152-2.17.1.patched/r8152.c
--- r8152-2.17.1/r8152.c	2024-03-12 09:43:05.130688336 +0100
+++ r8152-2.17.1.patched/r8152.c	2024-03-12 09:45:13.264694513 +0100
@@ -19691,7 +19691,7 @@
 		uinfo->idVendor = __le16_to_cpu(udev->descriptor.idVendor);
 		uinfo->idProduct = __le16_to_cpu(udev->descriptor.idProduct);
 		uinfo->bcdDevice = __le16_to_cpu(udev->descriptor.bcdDevice);
-		strlcpy(uinfo->devpath, udev->devpath, sizeof(udev->devpath));
+		strscpy(uinfo->devpath, udev->devpath, sizeof(udev->devpath));
 		pla_ocp_read(tp, PLA_IDR, sizeof(uinfo->dev_addr),
 			     uinfo->dev_addr);