ethtool: fix drvinfo strings set in drivers
Use strlcpy where possible to ensure the string is \0 terminated. Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN and custom defines. Use snprintf instead of sprint. Remove unnecessary inits of ->fw_version Remove unnecessary inits of drvinfo struct. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
这个提交包含在:
@@ -304,9 +304,9 @@ int netvsc_recv_callback(struct hv_device *device_obj,
|
||||
static void netvsc_get_drvinfo(struct net_device *net,
|
||||
struct ethtool_drvinfo *info)
|
||||
{
|
||||
strcpy(info->driver, KBUILD_MODNAME);
|
||||
strcpy(info->version, HV_DRV_VERSION);
|
||||
strcpy(info->fw_version, "N/A");
|
||||
strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
|
||||
strlcpy(info->version, HV_DRV_VERSION, sizeof(info->version));
|
||||
strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
|
||||
}
|
||||
|
||||
static int netvsc_change_mtu(struct net_device *ndev, int mtu)
|
||||
|
在新工单中引用
屏蔽一个用户