Fix kni build error, compatible with both strlcpy and strscpy.

This commit is contained in:
fengbojiang 2024-10-14 12:03:33 +08:00
parent 08fb383d70
commit 3fbb555e0d
1 changed files with 5 additions and 0 deletions

View File

@ -806,8 +806,13 @@ static const struct net_device_ops kni_net_netdev_ops = {
static void kni_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
#if __GNUC__ >= 13
strscpy(info->version, KNI_VERSION, sizeof(info->version));
strscpy(info->driver, "kni", sizeof(info->driver));
#else
strlcpy(info->version, KNI_VERSION, sizeof(info->version));
strlcpy(info->driver, "kni", sizeof(info->driver));
#endif
}
static const struct ethtool_ops kni_net_ethtool_ops = {