From 5824e037487f57e9e538047718804f3fb37016d0 Mon Sep 17 00:00:00 2001 From: sfwtw Date: Wed, 5 Mar 2025 15:19:13 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9Astrlcpy()=20is=20deprecated=20in=20?= =?UTF-8?q?kernel=206.8.0+,=20using=20strscpy=20instead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- driver/fibocom_QMI_WWAN/src/qmi_wwan_f.c | 6 ++++++ driver/quectel_QMI_WWAN/src/qmi_wwan_q.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/driver/fibocom_QMI_WWAN/src/qmi_wwan_f.c b/driver/fibocom_QMI_WWAN/src/qmi_wwan_f.c index 48efef7..2469ce1 100644 --- a/driver/fibocom_QMI_WWAN/src/qmi_wwan_f.c +++ b/driver/fibocom_QMI_WWAN/src/qmi_wwan_f.c @@ -1760,8 +1760,14 @@ static void ql_net_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *i { /* Inherit standard device info */ usbnet_get_drvinfo(net, info); + /* strlcpy() is deprecated in kernel 6.8.0+, using strscpy instead */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,8,0)) strlcpy(info->driver, driver_name, sizeof(info->driver)); strlcpy(info->version, VERSION_NUMBER, sizeof(info->version)); +#else + strscpy(info->driver, driver_name, sizeof(info->driver)); + strscpy(info->version, VERSION_NUMBER, sizeof(info->version)); +#endif } static struct ethtool_ops ql_net_ethtool_ops; diff --git a/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c b/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c index 99a9e9f..6a1dd08 100644 --- a/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c +++ b/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c @@ -1949,8 +1949,14 @@ static void ql_net_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *i { /* Inherit standard device info */ usbnet_get_drvinfo(net, info); + /* strlcpy() is deprecated in kernel 6.8.0+, using strscpy instead */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,8,0)) strlcpy(info->driver, driver_name, sizeof(info->driver)); strlcpy(info->version, VERSION_NUMBER, sizeof(info->version)); +#else + strscpy(info->driver, driver_name, sizeof(info->driver)); + strscpy(info->version, VERSION_NUMBER, sizeof(info->version)); +#endif } static struct ethtool_ops ql_net_ethtool_ops;