diff options
| author | Rick Jones <rick.jones2@hp.com> | 2011-11-07 08:29:27 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2011-11-08 15:11:57 -0500 |
| commit | 68aad78c5023b8aa82da99b47f9d8cf40e8ca453 (patch) | |
| tree | c9f90903bd2e7831ea6fc5231affa3b9fc908b73 /drivers | |
| parent | 34d2d89f2d7da3b72b3157e778bbf709047ded97 (diff) | |
sweep the floors and convert some .get_drvinfo routines to strlcpy
Per the mention made by Ben Hutchings that strlcpy is now the preferred
string copy routine for a .get_drvinfo routine, do a bit of floor
sweeping and convert some of the as-yet unconverted ethernet drivers to
it.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
38 files changed, 166 insertions, 136 deletions
diff --git a/drivers/net/ethernet/3com/3c589_cs.c b/drivers/net/ethernet/3com/3c589_cs.c index 972f80ecc510..da410f036869 100644 --- a/drivers/net/ethernet/3com/3c589_cs.c +++ b/drivers/net/ethernet/3com/3c589_cs.c | |||
| @@ -468,9 +468,10 @@ static void tc589_reset(struct net_device *dev) | |||
| 468 | static void netdev_get_drvinfo(struct net_device *dev, | 468 | static void netdev_get_drvinfo(struct net_device *dev, |
| 469 | struct ethtool_drvinfo *info) | 469 | struct ethtool_drvinfo *info) |
| 470 | { | 470 | { |
| 471 | strcpy(info->driver, DRV_NAME); | 471 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 472 | strcpy(info->version, DRV_VERSION); | 472 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 473 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 473 | snprintf(info->bus_info, sizeof(info->bus_info), |
| 474 | "PCMCIA 0x%lx", dev->base_addr); | ||
| 474 | } | 475 | } |
| 475 | 476 | ||
| 476 | static const struct ethtool_ops netdev_ethtool_ops = { | 477 | static const struct ethtool_ops netdev_ethtool_ops = { |
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index b42c06baba89..8153a3e0a1a4 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
| @@ -2929,15 +2929,17 @@ static void vortex_get_drvinfo(struct net_device *dev, | |||
| 2929 | { | 2929 | { |
| 2930 | struct vortex_private *vp = netdev_priv(dev); | 2930 | struct vortex_private *vp = netdev_priv(dev); |
| 2931 | 2931 | ||
| 2932 | strcpy(info->driver, DRV_NAME); | 2932 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 2933 | if (VORTEX_PCI(vp)) { | 2933 | if (VORTEX_PCI(vp)) { |
| 2934 | strcpy(info->bus_info, pci_name(VORTEX_PCI(vp))); | 2934 | strlcpy(info->bus_info, pci_name(VORTEX_PCI(vp)), |
| 2935 | sizeof(info->bus_info)); | ||
| 2935 | } else { | 2936 | } else { |
| 2936 | if (VORTEX_EISA(vp)) | 2937 | if (VORTEX_EISA(vp)) |
| 2937 | strcpy(info->bus_info, dev_name(vp->gendev)); | 2938 | strlcpy(info->bus_info, dev_name(vp->gendev), |
| 2939 | sizeof(info->bus_info)); | ||
| 2938 | else | 2940 | else |
| 2939 | sprintf(info->bus_info, "EISA 0x%lx %d", | 2941 | snprintf(info->bus_info, sizeof(info->bus_info), |
| 2940 | dev->base_addr, dev->irq); | 2942 | "EISA 0x%lx %d", dev->base_addr, dev->irq); |
| 2941 | } | 2943 | } |
| 2942 | } | 2944 | } |
| 2943 | 2945 | ||
diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c index 20ea07508ac7..6d6bc754b1a8 100644 --- a/drivers/net/ethernet/3com/typhoon.c +++ b/drivers/net/ethernet/3com/typhoon.c | |||
| @@ -988,21 +988,23 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
| 988 | 988 | ||
| 989 | smp_rmb(); | 989 | smp_rmb(); |
| 990 | if(tp->card_state == Sleeping) { | 990 | if(tp->card_state == Sleeping) { |
| 991 | strcpy(info->fw_version, "Sleep image"); | 991 | strlcpy(info->fw_version, "Sleep image", |
| 992 | sizeof(info->fw_version)); | ||
| 992 | } else { | 993 | } else { |
| 993 | INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS); | 994 | INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS); |
| 994 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { | 995 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { |
| 995 | strcpy(info->fw_version, "Unknown runtime"); | 996 | strlcpy(info->fw_version, "Unknown runtime", |
| 997 | sizeof(info->fw_version)); | ||
| 996 | } else { | 998 | } else { |
| 997 | u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); | 999 | u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); |
| 998 | snprintf(info->fw_version, 32, "%02x.%03x.%03x", | 1000 | snprintf(info->fw_version, sizeof(info->fw_version), |
| 999 | sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, | 1001 | "%02x.%03x.%03x", sleep_ver >> 24, |
| 1000 | sleep_ver & 0xfff); | 1002 | (sleep_ver >> 12) & 0xfff, sleep_ver & 0xfff); |
| 1001 | } | 1003 | } |
| 1002 | } | 1004 | } |
| 1003 | 1005 | ||
| 1004 | strcpy(info->driver, KBUILD_MODNAME); | 1006 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
| 1005 | strcpy(info->bus_info, pci_name(pci_dev)); | 1007 | strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info)); |
| 1006 | } | 1008 | } |
| 1007 | 1009 | ||
| 1008 | static int | 1010 | static int |
diff --git a/drivers/net/ethernet/8390/ne2k-pci.c b/drivers/net/ethernet/8390/ne2k-pci.c index 39923425ba25..3fab04a0034a 100644 --- a/drivers/net/ethernet/8390/ne2k-pci.c +++ b/drivers/net/ethernet/8390/ne2k-pci.c | |||
| @@ -639,9 +639,9 @@ static void ne2k_pci_get_drvinfo(struct net_device *dev, | |||
| 639 | struct ei_device *ei = netdev_priv(dev); | 639 | struct ei_device *ei = netdev_priv(dev); |
| 640 | struct pci_dev *pci_dev = (struct pci_dev *) ei->priv; | 640 | struct pci_dev *pci_dev = (struct pci_dev *) ei->priv; |
| 641 | 641 | ||
| 642 | strcpy(info->driver, DRV_NAME); | 642 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 643 | strcpy(info->version, DRV_VERSION); | 643 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 644 | strcpy(info->bus_info, pci_name(pci_dev)); | 644 | strlcpy(info->bus_info, pci_name(pci_dev), sizeof(info->bus_info)); |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | static const struct ethtool_ops ne2k_pci_ethtool_ops = { | 647 | static const struct ethtool_ops ne2k_pci_ethtool_ops = { |
diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c index 6d9f6911000f..a446e251908b 100644 --- a/drivers/net/ethernet/adaptec/starfire.c +++ b/drivers/net/ethernet/adaptec/starfire.c | |||
| @@ -1842,9 +1842,9 @@ static int check_if_running(struct net_device *dev) | |||
| 1842 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1842 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 1843 | { | 1843 | { |
| 1844 | struct netdev_private *np = netdev_priv(dev); | 1844 | struct netdev_private *np = netdev_priv(dev); |
| 1845 | strcpy(info->driver, DRV_NAME); | 1845 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1846 | strcpy(info->version, DRV_VERSION); | 1846 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1847 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 1847 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); |
| 1848 | } | 1848 | } |
| 1849 | 1849 | ||
| 1850 | static int get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 1850 | static int get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c b/drivers | |||
