提交 1f80c230 编写于 作者: R Rick Jones 提交者: John W. Linville

wireless: use strlcpy routine in .get_drvinfo

Convert various seemingly still compiled wireless drivers' .get_drvinfo
routines to use the preferred strlcpy() routine.
Signed-off-by: NRick Jones <rick.jones2@hp.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 6048d763
...@@ -3871,8 +3871,8 @@ static void prism2_get_drvinfo(struct net_device *dev, ...@@ -3871,8 +3871,8 @@ static void prism2_get_drvinfo(struct net_device *dev,
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
strncpy(info->driver, "hostap", sizeof(info->driver) - 1); strlcpy(info->driver, "hostap", sizeof(info->driver));
snprintf(info->fw_version, sizeof(info->fw_version) - 1, snprintf(info->fw_version, sizeof(info->fw_version),
"%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff, "%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff,
(local->sta_fw_ver >> 8) & 0xff, (local->sta_fw_ver >> 8) & 0xff,
local->sta_fw_ver & 0xff); local->sta_fw_ver & 0xff);
......
...@@ -5981,8 +5981,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, ...@@ -5981,8 +5981,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
struct ipw2100_priv *priv = libipw_priv(dev); struct ipw2100_priv *priv = libipw_priv(dev);
char fw_ver[64], ucode_ver[64]; char fw_ver[64], ucode_ver[64];
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver)); ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver));
ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver)); ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver));
...@@ -5990,7 +5990,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, ...@@ -5990,7 +5990,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s",
fw_ver, priv->eeprom_version, ucode_ver); fw_ver, priv->eeprom_version, ucode_ver);
strcpy(info->bus_info, pci_name(priv->pci_dev)); strlcpy(info->bus_info, pci_name(priv->pci_dev),
sizeof(info->bus_info));
} }
static u32 ipw2100_ethtool_get_link(struct net_device *dev) static u32 ipw2100_ethtool_get_link(struct net_device *dev)
......
...@@ -10548,8 +10548,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, ...@@ -10548,8 +10548,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
char date[32]; char date[32];
u32 len; u32 len;
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
len = sizeof(vers); len = sizeof(vers);
ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len); ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len);
...@@ -10558,7 +10558,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, ...@@ -10558,7 +10558,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)",
vers, date); vers, date);
strcpy(info->bus_info, pci_name(p->pci_dev)); strlcpy(info->bus_info, pci_name(p->pci_dev),
sizeof(info->bus_info));
info->eedump_len = IPW_EEPROM_IMAGE_SIZE; info->eedump_len = IPW_EEPROM_IMAGE_SIZE;
} }
......
...@@ -13,13 +13,14 @@ static void lbs_ethtool_get_drvinfo(struct net_device *dev, ...@@ -13,13 +13,14 @@ static void lbs_ethtool_get_drvinfo(struct net_device *dev,
{ {
struct lbs_private *priv = dev->ml_priv; struct lbs_private *priv = dev->ml_priv;
snprintf(info->fw_version, 32, "%u.%u.%u.p%u", snprintf(info->fw_version, sizeof(info->fw_version),
"%u.%u.%u.p%u",
priv->fwrelease >> 24 & 0xff, priv->fwrelease >> 24 & 0xff,
priv->fwrelease >> 16 & 0xff, priv->fwrelease >> 16 & 0xff,
priv->fwrelease >> 8 & 0xff, priv->fwrelease >> 8 & 0xff,
priv->fwrelease & 0xff); priv->fwrelease & 0xff);
strcpy(info->driver, "libertas"); strlcpy(info->driver, "libertas", sizeof(info->driver));
strcpy(info->version, lbs_driver_version); strlcpy(info->version, lbs_driver_version, sizeof(info->version));
} }
/* /*
......
...@@ -793,8 +793,8 @@ islpci_set_multicast_list(struct net_device *dev) ...@@ -793,8 +793,8 @@ islpci_set_multicast_list(struct net_device *dev)
static void islpci_ethtool_get_drvinfo(struct net_device *dev, static void islpci_ethtool_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
strcpy(info->driver, DRV_NAME); strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strcpy(info->version, DRV_VERSION); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
} }
static const struct ethtool_ops islpci_ethtool_ops = { static const struct ethtool_ops islpci_ethtool_ops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册