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/net | |
| 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/net')
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/net/ethernet/atheros/atl1e/atl1e_ethtool.c index 6269438d365f..6e61f9f9ebb5 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c | |||
| @@ -310,10 +310,12 @@ static void atl1e_get_drvinfo(struct net_device *netdev, | |||
| 310 | { | 310 | { |
| 311 | struct atl1e_adapter *adapter = netdev_priv(netdev); | 311 | struct atl1e_adapter *adapter = netdev_priv(netdev); |
| 312 | 312 | ||
| 313 | strncpy(drvinfo->driver, atl1e_driver_name, 32); | 313 | strlcpy(drvinfo->driver, atl1e_driver_name, sizeof(drvinfo->driver)); |
| 314 | strncpy(drvinfo->version, atl1e_driver_version, 32); | 314 | strlcpy(drvinfo->version, atl1e_driver_version, |
| 315 | strncpy(drvinfo->fw_version, "L1e", 32); | 315 | sizeof(drvinfo->version)); |
| 316 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); | 316 | strlcpy(drvinfo->fw_version, "L1e", sizeof(drvinfo->fw_version)); |
| 317 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), | ||
| 318 | sizeof(drvinfo->bus_info)); | ||
| 317 | drvinfo->n_stats = 0; | 319 | drvinfo->n_stats = 0; |
| 318 | drvinfo->testinfo_len = 0; | 320 | drvinfo->testinfo_len = 0; |
| 319 | drvinfo->regdump_len = atl1e_get_regs_len(netdev); | 321 | drvinfo->regdump_len = atl1e_get_regs_len(netdev); |
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index 1feae5928a4b..db3f43046d32 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c | |||
| @@ -2049,10 +2049,12 @@ static void atl2_get_drvinfo(struct net_device *netdev, | |||
| 2049 | { | 2049 | { |
| 2050 | struct atl2_adapter *adapter = netdev_priv(netdev); | 2050 | struct atl2_adapter *adapter = netdev_priv(netdev); |
| 2051 | 2051 | ||
| 2052 | strncpy(drvinfo->driver, atl2_driver_name, 32); | 2052 | strlcpy(drvinfo->driver, atl2_driver_name, sizeof(drvinfo->driver)); |
| 2053 | strncpy(drvinfo->version, atl2_driver_version, 32); | 2053 | strlcpy(drvinfo->version, atl2_driver_version, |
| 2054 | strncpy(drvinfo->fw_version, "L2", 32); | 2054 | sizeof(drvinfo->version)); |
| 2055 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); | 2055 | strlcpy(drvinfo->fw_version, "L2", sizeof(drvinfo->fw_version)); |
| 2056 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), | ||
| 2057 | sizeof(drvinfo->bus_info)); | ||
| 2056 | drvinfo->n_stats = 0; | 2058 | drvinfo->n_stats = 0; |
| 2057 | drvinfo->testinfo_len = 0; | 2059 | drvinfo->testinfo_len = 0; |
| 2058 | drvinfo->regdump_len = atl2_get_regs_len(netdev); | 2060 | drvinfo->regdump_len = atl2_get_regs_len(netdev); |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 965c7235804d..32d1f92a2479 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
| @@ -6873,10 +6873,10 @@ bnx2_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
| 6873 | { | 6873 | { |
| 6874 | struct bnx2 *bp = netdev_priv(dev); | 6874 | struct bnx2 *bp = netdev_priv(dev); |
| 6875 | 6875 | ||
| 6876 | strcpy(info->driver, DRV_MODULE_NAME); | 6876 | strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); |
| 6877 | strcpy(info->version, DRV_MODULE_VERSION); | 6877 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
| 6878 | strcpy(info->bus_info, pci_name(bp->pdev)); | 6878 | strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info)); |
| 6879 | strcpy(info->fw_version, bp->fw_version); | 6879 | strlcpy(info->fw_version, bp->fw_version, sizeof(info->fw_version)); |
| 6880 | } | 6880 | } |
| 6881 | 6881 | ||
| 6882 | #define BNX2_REGDUMP_LEN (32 * 1024) | 6882 | #define BNX2_REGDUMP_LEN (32 * 1024) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index f0ca8b27a55e..f6402fac26fd 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
| @@ -761,8 +761,8 @@ static void bnx2x_get_drvinfo(struct net_device *dev, | |||
| 761 | struct bnx2x *bp = netdev_priv(dev); | 761 | struct bnx2x *bp = netdev_priv(dev); |
| 762 | u8 phy_fw_ver[PHY_FW_VER_LEN]; | 762 | u8 phy_fw_ver[PHY_FW_VER_LEN]; |
| 763 | 763 | ||
| 764 | strcpy(info->driver, DRV_MODULE_NAME); | 764 | strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); |
| 765 | strcpy(info->version, DRV_MODULE_VERSION); | 765 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
| 766 | 766 | ||
| 767 | phy_fw_ver[0] = '\0'; | 767 | phy_fw_ver[0] = '\0'; |
| 768 | if (bp->port.pmf) { | 768 | if (bp->port.pmf) { |
| @@ -773,14 +773,14 @@ static void bnx2x_get_drvinfo(struct net_device *dev, | |||
| 773 | bnx2x_release_phy_lock(bp); | 773 | bnx2x_release_phy_lock(bp); |
| 774 | } | 774 | } |
| 775 | 775 | ||
| 776 | strncpy(info->fw_version, bp->fw_ver, 32); | 776 | strlcpy(info->fw_version, bp->fw_ver, sizeof(info->fw_version)); |
| 777 | snprintf(info->fw_version + strlen(bp->fw_ver), 32 - strlen(bp->fw_ver), | 777 | snprintf(info->fw_version + strlen(bp->fw_ver), 32 - strlen(bp->fw_ver), |
| 778 | "bc %d.%d.%d%s%s", | 778 | "bc %d.%d.%d%s%s", |
| 779 | (bp->common.bc_ver & 0xff0000) >> 16, | 779 | (bp->common.bc_ver & 0xff0000) >> 16, |
| 780 | (bp->common.bc_ver & 0xff00) >> 8, | 780 | (bp->common.bc_ver & 0xff00) >> 8, |
| 781 | (bp->common.bc_ver & 0xff), | 781 | (bp->common.bc_ver & 0xff), |
| 782 | ((phy_fw_ver[0] != '\0') ? " phy " : ""), phy_fw_ver); | 782 | ((phy_fw_ver[0] != '\0') ? " phy " : ""), phy_fw_ver); |
| 783 | strcpy(info->bus_info, pci_name(bp->pdev)); | 783 | strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info)); |
| 784 | info->n_stats = BNX2X_NUM_STATS; | 784 | info->n_stats = BNX2X_NUM_STATS; |
| 785 | info->testinfo_len = BNX2X_NUM_TESTS; | 785 | info->testinfo_len = BNX2X_NUM_TESTS; |
| 786 | info->eedump_len = bp->common.flash_size; | 786 | info->eedump_len = bp->common.flash_size; |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index bf4074167d6a..cd3623416a4e 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -10428,10 +10428,10 @@ static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info | |||
| 10428 | { | 10428 | { |
| 10429 | struct tg3 *tp = netdev_priv(dev); | 10429 | struct tg3 *tp = netdev_priv(dev); |
| 10430 | 10430 | ||
| 10431 | strcpy(info->driver, DRV_MODULE_NAME); | 10431 | strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); |
| 10432 | strcpy(info->version, DRV_MODULE_VERSION); | 10432 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
| 10433 | strcpy(info->fw_version, tp->fw_ver); | 10433 | strlcpy(info->fw_version, tp->fw_ver, sizeof(info->fw_version)); |
| 10434 | strcpy(info->bus_info, pci_name(tp->pdev)); | 10434 | strlcpy(info->bus_info, pci_name(tp->pdev), sizeof(info->bus_info)); |
| 10435 | } | 10435 | } |
| 10436 | 10436 | ||
| 10437 | static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 10437 | static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
diff --git a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c index fd3dcc1e9145..38d5c66075f9 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c +++ b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c | |||
| @@ -296,8 +296,8 @@ bnad_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
| 296 | struct bfa_ioc_attr *ioc_attr; | 296 | struct bfa_ioc_attr *ioc_attr; |
| 297 | unsigned long flags; | 297 | unsigned long flags; |
| 298 | 298 | ||
| 299 | strcpy(drvinfo->driver, BNAD_NAME); | 299 | strlcpy(drvinfo->driver, BNAD_NAME, sizeof(drvinfo->driver)); |
| 300 | strcpy(drvinfo->version, BNAD_VERSION); | 300 | strlcpy(drvinfo->version, BNAD_VERSION, sizeof(drvinfo->version)); |
| 301 | 301 | ||
| 302 | ioc_attr = kzalloc(sizeof(*ioc_attr), GFP_KERNEL); | 302 | ioc_attr = kzalloc(sizeof(*ioc_attr), GFP_KERNEL); |
| 303 | if (ioc_attr) { | 303 | if (ioc_attr) { |
| @@ -305,12 +305,13 @@ bnad_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
| 305 | bfa_nw_ioc_get_attr(&bnad->bna.ioceth.ioc, ioc_attr); | 305 | bfa_nw_ioc_get_attr(&bnad->bna.ioceth.ioc, ioc_attr); |
| 306 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | 306 | spin_unlock_irqrestore(&bnad->bna_lock, flags); |
| 307 | 307 | ||
| 308 | strncpy(drvinfo->fw_version, ioc_attr->adapter_attr.fw_ver, | 308 | strlcpy(drvinfo->fw_version, ioc_attr->adapter_attr.fw_ver, |
| 309 | sizeof(drvinfo->fw_version) - 1); | 309 | sizeof(drvinfo->fw_version)); |
| 310 | kfree(ioc_attr); | 310 | kfree(ioc_attr); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | strncpy(drvinfo->bus_info, pci_name(bnad->pcidev), ETHTOOL_BUSINFO_LEN); | 313 | strlcpy(drvinfo->bus_info, pci_name(bnad->pcidev), |
| 314 | sizeof(drvinfo->bus_info)); | ||
| 314 | } | 315 | } |
| 315 | 316 | ||
| 316 | static void | 317 | static void |
diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c index 1427739d9a51..1eb46a0bb488 100644 --- a/drivers/net/ethernet/dec/tulip/de2104x.c +++ b/drivers/net/ethernet/dec/tulip/de2104x.c | |||
| @@ -1598,9 +1598,9 @@ static void de_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info) | |||
| 1598 | { | 1598 | { |
| 1599 | struct de_private *de = netdev_priv(dev); | 1599 | struct de_private *de = netdev_priv(dev); |
| 1600 | 1600 | ||
| 1601 | strcpy (info->driver, DRV_NAME); | 1601 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1602 | strcpy (info->version, DRV_VERSION); | 1602 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1603 | strcpy (info->bus_info, pci_name(de->pdev)); | 1603 | strlcpy(info->bus_info, pci_name(de->pdev), sizeof(info->bus_info)); |
| 1604 | info->eedump_len = DE_EEPROM_SIZE; | 1604 | info->eedump_len = DE_EEPROM_SIZE; |
| 1605 | } | 1605 | } |
| 1606 | 1606 | ||
diff --git a/drivers/net/ethernet/dec/tulip/dmfe.c b/drivers/net/ethernet/dec/tulip/dmfe.c index 17b11ee1745a..51f7542eb451 100644 --- a/drivers/net/ethernet/dec/tulip/dmfe.c +++ b/drivers/net/ethernet/dec/tulip/dmfe.c | |||
| @@ -1085,10 +1085,11 @@ static void dmfe_ethtool_get_drvinfo(struct net_device *dev, | |||
| 1085 | { | 1085 | { |
| 1086 | struct dmfe_board_info *np = netdev_priv(dev); | 1086 | struct dmfe_board_info *np = netdev_priv(dev); |
| 1087 | 1087 | ||
| 1088 | strcpy(info->driver, DRV_NAME); | 1088 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1089 | strcpy(info->version, DRV_VERSION); | 1089 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1090 | if (np->pdev) | 1090 | if (np->pdev) |
| 1091 | strcpy(info->bus_info, pci_name(np->pdev)); | 1091 | strlcpy(info->bus_info, pci_name(np->pdev), |
| 1092 | sizeof(info->bus_info)); | ||
| 1092 | else | 1093 | else |
| 1093 | sprintf(info->bus_info, "EISA 0x%lx %d", | 1094 | sprintf(info->bus_info, "EISA 0x%lx %d", |
| 1094 | dev->base_addr, dev->irq); | 1095 | dev->base_addr, dev->irq); |
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c index 9656dd0647d9..4eb0d76145c2 100644 --- a/drivers/net/ethernet/dec/tulip/tulip_core.c +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c | |||
| @@ -871,9 +871,9 @@ static struct net_device_stats *tulip_get_stats(struct net_device *dev) | |||
| 871 | static void tulip_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 871 | static void tulip_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 872 | { | 872 | { |
| 873 | struct tulip_private *np = netdev_priv(dev); | 873 | struct tulip_private *np = netdev_priv(dev); |
| 874 | strcpy(info->driver, DRV_NAME); | 874 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 875 | strcpy(info->version, DRV_VERSION); | 875 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 876 | strcpy(info->bus_info, pci_name(np->pdev)); | 876 | strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); |
| 877 | } | 877 | } |
| 878 | 878 | ||
| 879 | 879 | ||
diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c index 7a44a7a6adc8..48b0b6566eef 100644 --- a/drivers/net/ethernet/dec/tulip/uli526x.c +++ b/drivers/net/ethernet/dec/tulip/uli526x.c | |||
| @@ -960,10 +960,11 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
| 960 | { | 960 | { |
| 961 | struct uli526x_board_info *np = netdev_priv(dev); | 961 | struct uli526x_board_info *np = netdev_priv(dev); |
| 962 | 962 | ||
| 963 | strcpy(info->driver, DRV_NAME); | 963 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 964 | strcpy(info->version, DRV_VERSION); | 964 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 965 | if (np->pdev) | 965 | if (np->pdev) |
| 966 | strcpy(info->bus_info, pci_name(np->pdev)); | 966 | strlcpy(info->bus_info, pci_name(np->pdev), |
| 967 | sizeof(info->bus_info)); | ||
| 967 | else | 968 | else |
| 968 | sprintf(info->bus_info, "EISA 0x%lx %d", | 969 | sprintf(info->bus_info, "EISA 0x%lx %d", |
| 969 | dev->base_addr, dev->irq); | 970 | dev->base_addr, dev->irq); |
diff --git a/drivers/net/ethernet/dec/tulip/winbond-840.c b/drivers/net/ethernet/dec/tulip/winbond-840.c index 4d01219ba22f..52da7b2fe3b6 100644 --- a/drivers/net/ethernet/dec/tulip/winbond-840.c +++ b/drivers/net/ethernet/dec/tulip/winbond-840.c | |||
| @@ -1390,9 +1390,9 @@ static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo * | |||
| 1390 | { | 1390 | { |
| 1391 | struct netdev_private *np = netdev_priv(dev); | 1391 | struct netdev_private *np = netdev_priv(dev); |
| 1392 | 1392 | ||
| 1393 | strcpy (info->driver, DRV_NAME); | 1393 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1394 | strcpy (info->version, DRV_VERSION); | 1394 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1395 | strcpy (info->bus_info, pci_name(np->pci_dev)); | 1395 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); |
| 1396 | } | 1396 | } |
| 1397 | 1397 | ||
| 1398 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1398 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/dlink/sundance.c b/drivers/net/ethernet/dlink/sundance.c index dcd7f7a71ad4..28a3a9b50b8b 100644 --- a/drivers/net/ethernet/dlink/sundance.c +++ b/drivers/net/ethernet/dlink/sundance.c | |||
| @@ -1634,9 +1634,9 @@ static int check_if_running(struct net_device *dev) | |||
| 1634 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1634 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 1635 | { | 1635 | { |
| 1636 | struct netdev_private *np = netdev_priv(dev); | 1636 | struct netdev_private *np = netdev_priv(dev); |
| 1637 | strcpy(info->driver, DRV_NAME); | 1637 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1638 | strcpy(info->version, DRV_VERSION); | 1638 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1639 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 1639 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); |
| 1640 | } | 1640 | } |
| 1641 | 1641 | ||
| 1642 | static int get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 1642 | static int get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c index c1063d1540c2..d94b9686b80c 100644 --- a/drivers/net/ethernet/dnet.c +++ b/drivers/net/ethernet/dnet.c | |||
| @@ -804,9 +804,9 @@ static int dnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 804 | static void dnet_get_drvinfo(struct net_device *dev, | 804 | static void dnet_get_drvinfo(struct net_device *dev, |
| 805 | struct ethtool_drvinfo *info) | 805 | struct ethtool_drvinfo *info) |
| 806 | { | 806 | { |
| 807 | strcpy(info->driver, DRV_NAME); | 807 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 808 | strcpy(info->version, DRV_VERSION); | 808 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 809 | strcpy(info->bus_info, "0"); | 809 | strlcpy(info->bus_info, "0", sizeof(info->bus_info)); |
| 810 | } | 810 | } |
| 811 | 811 | ||
| 812 | static const struct ethtool_ops dnet_ethtool_ops = { | 812 | static const struct ethtool_ops dnet_ethtool_ops = { |
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index bf8153ea4ed8..1ad7a28fae6a 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
| @@ -127,8 +127,8 @@ static void be_get_drvinfo(struct net_device *netdev, | |||
| 127 | memset(fw_on_flash, 0 , sizeof(fw_on_flash)); | 127 | memset(fw_on_flash, 0 , sizeof(fw_on_flash)); |
| 128 | be_cmd_get_fw_ver(adapter, adapter->fw_ver, fw_on_flash); | 128 | be_cmd_get_fw_ver(adapter, adapter->fw_ver, fw_on_flash); |
| 129 | 129 | ||
| 130 | strcpy(drvinfo->driver, DRV_NAME); | 130 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
| 131 | strcpy(drvinfo->version, DRV_VER); | 131 | strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version)); |
| 132 | strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN); | 132 | strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN); |
| 133 | if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) { | 133 | if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) { |
| 134 | strcat(drvinfo->fw_version, " ["); | 134 | strcat(drvinfo->fw_version, " ["); |
| @@ -136,7 +136,8 @@ static void be_get_drvinfo(struct net_device *netdev, | |||
| 136 | strcat(drvinfo->fw_version, "]"); | 136 | strcat(drvinfo->fw_version, "]"); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | strcpy(drvinfo->bus_info, pci_name(adapter->pdev)); | 139 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
| 140 | sizeof(drvinfo->bus_info)); | ||
| 140 | drvinfo->testinfo_len = 0; | 141 | drvinfo->testinfo_len = 0; |
| 141 | drvinfo->regdump_len = 0; | 142 | drvinfo->regdump_len = 0; |
| 142 | drvinfo->eedump_len = 0; | 143 | drvinfo->eedump_len = 0; |
diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c index 61d2bddec1fa..c82d444b582d 100644 --- a/drivers/net/ethernet/fealnx.c +++ b/drivers/net/ethernet/fealnx.c | |||
| @@ -1818,9 +1818,9 @@ static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i | |||
| 1818 | { | 1818 | { |
| 1819 | struct netdev_private *np = netdev_priv(dev); | 1819 | struct netdev_private *np = netdev_priv(dev); |
| 1820 | 1820 | ||
| 1821 | strcpy(info->driver, DRV_NAME); | 1821 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1822 | strcpy(info->version, DRV_VERSION); | 1822 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1823 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 1823 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); |
| 1824 | } | 1824 | } |
| 1825 | 1825 | ||
| 1826 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1826 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/i825xx/eepro.c b/drivers/net/ethernet/i825xx/eepro.c index 067c46069a11..114cda7721fe 100644 --- a/drivers/net/ethernet/i825xx/eepro.c +++ b/drivers/net/ethernet/i825xx/eepro.c | |||
| @@ -1726,9 +1726,10 @@ static int eepro_ethtool_get_settings(struct net_device *dev, | |||
| 1726 | static void eepro_ethtool_get_drvinfo(struct net_device *dev, | 1726 | static void eepro_ethtool_get_drvinfo(struct net_device *dev, |
| 1727 | struct ethtool_drvinfo *drvinfo) | 1727 | struct ethtool_drvinfo *drvinfo) |
| 1728 | { | 1728 | { |
| 1729 | strcpy(drvinfo->driver, DRV_NAME); | 1729 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
| 1730 | strcpy(drvinfo->version, DRV_VERSION); | 1730 | strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); |
| 1731 | sprintf(drvinfo->bus_info, "ISA 0x%lx", dev->base_addr); | 1731 | snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), |
| 1732 | "ISA 0x%lx", dev->base_addr); | ||
| 1732 | } | 1733 | } |
| 1733 | 1734 | ||
| 1734 | static const struct ethtool_ops eepro_ethtool_ops = { | 1735 | static const struct ethtool_ops eepro_ethtool_ops = { |
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 194a03113802..f6b4304ca459 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
| @@ -1502,10 +1502,11 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
| 1502 | static void mv643xx_eth_get_drvinfo(struct net_device *dev, | 1502 | static void mv643xx_eth_get_drvinfo(struct net_device *dev, |
| 1503 | struct ethtool_drvinfo *drvinfo) | 1503 | struct ethtool_drvinfo *drvinfo) |
| 1504 | { | 1504 | { |
| 1505 | strncpy(drvinfo->driver, mv643xx_eth_driver_name, 32); | 1505 | strlcpy(drvinfo->driver, mv643xx_eth_driver_name, sizeof(info->driver)); |
| 1506 | strncpy(drvinfo->version, mv643xx_eth_driver_version, 32); | 1506 | strlcpy(drvinfo->version, mv643xx_eth_driver_version, |
| 1507 | strncpy(drvinfo->fw_version, "N/A", 32); | 1507 | sizeof(info->version)); |
| 1508 | strncpy(drvinfo->bus_info, "platform", 32); | 1508 | strlcpy(drvinfo->fw_version, "N/A", sizeof(info->fw_version)); |
| 1509 | strlcpy(drvinfo->bus_info, "platform", sizeof(info->bus_info)); | ||
| 1509 | drvinfo->n_stats = ARRAY_SIZE(mv643xx_eth_stats); | 1510 | drvinfo->n_stats = ARRAY_SIZE(mv643xx_eth_stats); |
| 1510 | } | 1511 | } |
| 1511 | 1512 | ||
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index c7b60839ac99..3943f5f7bb4a 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
| @@ -394,10 +394,11 @@ static void skge_get_drvinfo(struct net_device *dev, | |||
| 394 | { | 394 | { |
| 395 | struct skge_port *skge = netdev_priv(dev); | 395 | struct skge_port *skge = netdev_priv(dev); |
| 396 | 396 | ||
| 397 | strcpy(info->driver, DRV_NAME); | 397 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 398 | strcpy(info->version, DRV_VERSION); | 398 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 399 | strcpy(info->fw_version, "N/A"); | 399 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
| 400 | strcpy(info->bus_info, pci_name(skge->hw->pdev)); | 400 | strlcpy(info->bus_info, pci_name(skge->hw->pdev), |
| 401 | sizeof(info->bus_info)); | ||
| 401 | } | 402 | } |
| 402 | 403 | ||
| 403 | static const struct skge_stat { | 404 | static const struct skge_stat { |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index fdc6c394c683..553d1a315b3a 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
| @@ -3623,10 +3623,11 @@ static void sky2_get_drvinfo(struct net_device *dev, | |||
| 3623 | { | 3623 | { |
| 3624 | struct sky2_port *sky2 = netdev_priv(dev); | 3624 | struct sky2_port *sky2 = netdev_priv(dev); |
| 3625 | 3625 | ||
| 3626 | strcpy(info->driver, DRV_NAME); | 3626 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 3627 | strcpy(info->version, DRV_VERSION); | 3627 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 3628 | strcpy(info->fw_version, "N/A"); | 3628 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
| 3629 | strcpy(info->bus_info, pci_name(sky2->hw->pdev)); | 3629 | strlcpy(info->bus_info, pci_name(sky2->hw->pdev), |
| 3630 | sizeof(info->bus_info)); | ||
| 3630 | } | 3631 | } |
| 3631 | 3632 | ||
| 3632 | static const struct sky2_stat { | 3633 | static const struct sky2_stat { |
diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c index 6ca047aab793..ac7b16b6e7af 100644 --- a/drivers/net/ethernet/natsemi/natsemi.c +++ b/drivers/net/ethernet/natsemi/natsemi.c | |||
| @@ -2555,9 +2555,9 @@ static void set_rx_mode(struct net_device *dev) | |||
| 2555 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 2555 | static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 2556 | { | 2556 | { |
| 2557 | struct netdev_private *np = netdev_priv(dev); | 2557 | struct netdev_private *np = netdev_priv(dev); |
| 2558 | strncpy(info->driver, DRV_NAME, ETHTOOL_BUSINFO_LEN); | 2558 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 2559 | strncpy(info->version, DRV_VERSION, ETHTOOL_BUSINFO_LEN); | 2559 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 2560 | strncpy(info->bus_info, pci_name(np->pci_dev), ETHTOOL_BUSINFO_LEN); | 2560 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); |
| 2561 | } | 2561 | } |
| 2562 | 2562 | ||
| 2563 | static int get_regs_len(struct net_device *dev) | 2563 | static int get_regs_len(struct net_device *dev) |
diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c index 2b8f64ddfb55..c24b46cbfe27 100644 --- a/drivers/net/ethernet/natsemi/ns83820.c +++ b/drivers/net/ethernet/natsemi/ns83820.c | |||
| @@ -1364,9 +1364,9 @@ static int ns83820_set_settings(struct net_device *ndev, | |||
| 1364 | static void ns83820_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info) | 1364 | static void ns83820_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info) |
| 1365 | { | 1365 | { |
| 1366 | struct ns83820 *dev = PRIV(ndev); | 1366 | struct ns83820 *dev = PRIV(ndev); |
| 1367 | strcpy(info->driver, "ns83820"); | 1367 | strlcpy(info->driver, "ns83820", sizeof(info->driver)); |
| 1368 | strcpy(info->version, VERSION); | 1368 | strlcpy(info->version, VERSION, sizeof(info->version)); |
| 1369 | strcpy(info->bus_info, pci_name(dev->pci_dev)); | 1369 | strlcpy(info->bus_info, pci_name(dev->pci_dev), sizeof(info->bus_info)); |
| 1370 | } | 1370 | } |
| 1371 | 1371 | ||
| 1372 | static u32 ns83820_get_link(struct net_device *ndev) | 1372 | static u32 ns83820_get_link(struct net_device *ndev) |
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index c27fb3dda9f4..e6c90a5ac5d4 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c | |||
| @@ -5391,10 +5391,10 @@ static void s2io_ethtool_gdrvinfo(struct net_device *dev, | |||
| 5391 | { | 5391 | { |
| 5392 | struct s2io_nic *sp = netdev_priv(dev); | 5392 | struct s2io_nic *sp = netdev_priv(dev); |
| 5393 | 5393 | ||
| 5394 | strncpy(info->driver, s2io_driver_name, sizeof(info->driver)); | 5394 | strlcpy(info->driver, s2io_driver_name, sizeof(info->driver)); |
| 5395 | strncpy(info->version, s2io_driver_version, sizeof(info->version)); | 5395 | strlcpy(info->version, s2io_driver_version, sizeof(info->version)); |
| 5396 | strncpy(info->fw_version, "", sizeof(info->fw_version)); | 5396 | strlcpy(info->fw_version, "", sizeof(info->fw_version)); |
| 5397 | strncpy(info->bus_info, pci_name(sp->pdev), sizeof(info->bus_info)); | 5397 | strlcpy(info->bus_info, pci_name(sp->pdev), sizeof(info->bus_info)); |
| 5398 | info->regdump_len = XENA_REG_SPACE; | 5398 | info->regdump_len = XENA_REG_SPACE; |
| 5399 | info->eedump_len = XENA_EEPROM_SPACE; | 5399 | info->eedump_len = XENA_EEPROM_SPACE; |
| 5400 | } | 5400 | } |
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 1dca57013cb2..d24c45bec508 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
| @@ -3900,9 +3900,9 @@ static void nv_do_stats_poll(unsigned long data) | |||
| 3900 | static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 3900 | static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 3901 | { | 3901 | { |
| 3902 | struct fe_priv *np = netdev_priv(dev); | 3902 | struct fe_priv *np = netdev_priv(dev); |
| 3903 | strcpy(info->driver, DRV_NAME); | 3903 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 3904 | strcpy(info->version, FORCEDETH_VERSION); | 3904 | strlcpy(info->version, FORCEDETH_VERSION, sizeof(info->version)); |
| 3905 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 3905 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); |
| 3906 | } | 3906 | } |
| 3907 | 3907 | ||
| 3908 | static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) | 3908 | static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c index e09ea83b8c47..8a371985319f 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c | |||
| @@ -83,14 +83,18 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) | |||
| 83 | u32 fw_minor = 0; | 83 | u32 fw_minor = 0; |
| 84 | u32 fw_build = 0; | 84 | u32 fw_build = 0; |
| 85 | 85 | ||
| 86 | strncpy(drvinfo->driver, netxen_nic_driver_name, 32); | 86 | strlcpy(drvinfo->driver, netxen_nic_driver_name, |
| 87 | strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); | 87 | sizeof(drvinfo->driver)); |
| 88 | strlcpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, | ||
| 89 | sizeof(drvinfo->version)); | ||
| 88 | fw_major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); | 90 | fw_major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); |
| 89 | fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); | 91 | fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); |
| 90 | fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); | 92 | fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); |
| 91 | sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); | 93 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
| 94 | "%d.%d.%d", fw_major, fw_minor, fw_build); | ||
| 92 | 95 | ||
| 93 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); | 96 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
| 97 | sizeof(drvinfo->bus_info)); | ||
| 94 | drvinfo->regdump_len = NETXEN_NIC_REGS_LEN; | 98 | drvinfo->regdump_len = NETXEN_NIC_REGS_LEN; |
| 95 | drvinfo->eedump_len = netxen_nic_get_eeprom_len(dev); | 99 | drvinfo->eedump_len = netxen_nic_get_eeprom_len(dev); |
| 96 | } | 100 | } |
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index a4bdff438a5e..9416f297100e 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c | |||
| @@ -1735,10 +1735,12 @@ static void ql_get_drvinfo(struct net_device *ndev, | |||
| 1735 | struct ethtool_drvinfo *drvinfo) | 1735 | struct ethtool_drvinfo *drvinfo) |
| 1736 | { | 1736 | { |
| 1737 | struct ql3_adapter *qdev = netdev_priv(ndev); | 1737 | struct ql3_adapter *qdev = netdev_priv(ndev); |
| 1738 | strncpy(drvinfo->driver, ql3xxx_driver_name, 32); | 1738 | strlcpy(drvinfo->driver, ql3xxx_driver_name, sizeof(drvinfo->driver)); |
| 1739 | strncpy(drvinfo->version, ql3xxx_driver_version, 32); | 1739 | strlcpy(drvinfo->version, ql3xxx_driver_version, |
| 1740 | strncpy(drvinfo->fw_version, "N/A", 32); | 1740 | sizeof(drvinfo->version)); |
| 1741 | strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); | 1741 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
| 1742 | strlcpy(drvinfo->bus_info, pci_name(qdev->pdev), | ||
| 1743 | sizeof(drvinfo->bus_info)); | ||
| 1742 | drvinfo->regdump_len = 0; | 1744 | drvinfo->regdump_len = 0; |
| 1743 | drvinfo->eedump_len = 0; | 1745 | drvinfo->eedump_len = 0; |
| 1744 | } | 1746 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 8aa1c6e8667b..cc228cf3d84b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
| @@ -140,11 +140,14 @@ qlcnic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) | |||
| 140 | fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR); | 140 | fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR); |
| 141 | fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR); | 141 | fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR); |
| 142 | fw_build = QLCRD32(adapter, QLCNIC_FW_VERSION_SUB); | 142 | fw_build = QLCRD32(adapter, QLCNIC_FW_VERSION_SUB); |
| 143 | sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); | 143 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
| 144 | 144 | "%d.%d.%d", fw_major, fw_minor, fw_build); | |
| 145 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); | 145 | |
| 146 | strlcpy(drvinfo->driver, qlcnic_driver_name, 32); | 146 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
| 147 | strlcpy(drvinfo->version, QLCNIC_LINUX_VERSIONID, 32); | 147 | sizeof(drvinfo->bus_info)); |
| 148 | strlcpy(drvinfo->driver, qlcnic_driver_name, sizeof(drvinfo->driver)); | ||
| 149 | strlcpy(drvinfo->version, QLCNIC_LINUX_VERSIONID, | ||
| 150 | sizeof(drvinfo->version)); | ||
| 148 | } | 151 | } |
| 149 | 152 | ||
| 150 | static int | 153 | static int |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c index 9b67bfea035f..8e2c2a74f3a5 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | |||
| @@ -366,13 +366,16 @@ static void ql_get_drvinfo(struct net_device *ndev, | |||
| 366 | struct ethtool_drvinfo *drvinfo) | 366 | struct ethtool_drvinfo *drvinfo) |
| 367 | { | 367 | { |
| 368 | struct ql_adapter *qdev = netdev_priv(ndev); | 368 | struct ql_adapter *qdev = netdev_priv(ndev); |
| 369 | strncpy(drvinfo->driver, qlge_driver_name, 32); | 369 | strlcpy(drvinfo->driver, qlge_driver_name, sizeof(drvinfo->driver)); |
| 370 | strncpy(drvinfo->version, qlge_driver_version, 32); | 370 | strlcpy(drvinfo->version, qlge_driver_version, |
| 371 | snprintf(drvinfo->fw_version, 32, "v%d.%d.%d", | 371 | sizeof(drvinfo->version)); |
| 372 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), | ||
| 373 | "v%d.%d.%d", | ||
| 372 | (qdev->fw_rev_id & 0x00ff0000) >> 16, | 374 | (qdev->fw_rev_id & 0x00ff0000) >> 16, |
| 373 | (qdev->fw_rev_id & 0x0000ff00) >> 8, | 375 | (qdev->fw_rev_id & 0x0000ff00) >> 8, |
| 374 | (qdev->fw_rev_id & 0x000000ff)); | 376 | (qdev->fw_rev_id & 0x000000ff)); |
| 375 | strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); | 377 | strlcpy(drvinfo->bus_info, pci_name(qdev->pdev), |
| 378 | sizeof(drvinfo->bus_info)); | ||
| 376 | drvinfo->n_stats = 0; | 379 | drvinfo->n_stats = 0; |
| 377 | drvinfo->testinfo_len = 0; | 380 | drvinfo->testinfo_len = 0; |
| 378 | if (!test_bit(QL_FRC_COREDUMP, &qdev->flags)) | 381 | if (!test_bit(QL_FRC_COREDUMP, &qdev->flags)) |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index ee5da9293ce0..6cfc5dc0f76e 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
| @@ -1319,9 +1319,9 @@ static void cp_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info | |||
| 1319 | { | 1319 | { |
| 1320 | struct cp_private *cp = netdev_priv(dev); | 1320 | struct cp_private *cp = netdev_priv(dev); |
| 1321 | 1321 | ||
| 1322 | strcpy (info->driver, DRV_NAME); | 1322 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1323 | strcpy (info->version, DRV_VERSION); | 1323 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1324 | strcpy (info->bus_info, pci_name(cp->pdev)); | 1324 | strlcpy(info->bus_info, pci_name(cp->pdev), sizeof(info->bus_info)); |
| 1325 | } | 1325 | } |
| 1326 | 1326 | ||
| 1327 | static void cp_get_ringparam(struct net_device *dev, | 1327 | static void cp_get_ringparam(struct net_device *dev, |
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index 4d6b254fc6c1..d9c72273e428 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c | |||
| @@ -2330,9 +2330,9 @@ static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
| 2330 | static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 2330 | static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
| 2331 | { | 2331 | { |
| 2332 | struct rtl8139_private *tp = netdev_priv(dev); | 2332 | struct rtl8139_private *tp = netdev_priv(dev); |
| 2333 | strcpy(info->driver, DRV_NAME); | 2333 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 2334 | strcpy(info->version, DRV_VERSION); | 2334 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 2335 | strcpy(info->bus_info, pci_name(tp->pci_dev)); | 2335 | strlcpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info)); |
| 2336 | info->regdump_len = tp->regs_len; | 2336 | info->regdump_len = tp->regs_len; |
| 2337 | } | 2337 | } |
| 2338 | 2338 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 6f06aa10f0d7..cdf66d68d849 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -1404,12 +1404,12 @@ static void rtl8169_get_drvinfo(struct net_device *dev, | |||
| 1404 | struct rtl8169_private *tp = netdev_priv(dev); | 1404 | struct rtl8169_private *tp = netdev_priv(dev); |
| 1405 | struct rtl_fw *rtl_fw = tp->rtl_fw; | 1405 | struct rtl_fw *rtl_fw = tp->rtl_fw; |
| 1406 | 1406 | ||
| 1407 | strcpy(info->driver, MODULENAME); | 1407 | strlcpy(info->driver, MODULENAME, sizeof(info->driver)); |
| 1408 | strcpy(info->version, RTL8169_VERSION); | 1408 | strlcpy(info->version, RTL8169_VERSION, sizeof(info->version)); |
| 1409 | strcpy(info->bus_info, pci_name(tp->pci_dev)); | 1409 | strlcpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info)); |
| 1410 | BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version)); | 1410 | BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version)); |
| 1411 | strcpy(info->fw_version, IS_ERR_OR_NULL(rtl_fw) ? "N/A" : | 1411 | strlcpy(info->fw_version, IS_ERR_OR_NULL(rtl_fw) ? "N/A" : |
| 1412 | rtl_fw->version); | 1412 | rtl_fw->version, sizeof(info->fw_version)); |
| 1413 | } | 1413 | } |
| 1414 | 1414 | ||
| 1415 | static int rtl8169_get_regs_len(struct net_device *dev) | 1415 | static int rtl8169_get_regs_len(struct net_device *dev) |
diff --git a/drivers/net/ethernet/smsc/epic100.c b/drivers/net/ethernet/smsc/epic100.c index 0a5dfb814157..2c077ce0b6d6 100644 --- a/drivers/net/ethernet/smsc/epic100.c +++ b/drivers/net/ethernet/smsc/epic100.c | |||
| @@ -1414,9 +1414,9 @@ static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo * | |||
| 1414 | { | 1414 | { |
| 1415 | struct epic_private *np = netdev_priv(dev); | 1415 | struct epic_private *np = netdev_priv(dev); |
| 1416 | 1416 | ||
| 1417 | strcpy (info->driver, DRV_NAME); | 1417 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 1418 | strcpy (info->version, DRV_VERSION); | 1418 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 1419 | strcpy (info->bus_info, pci_name(np->pci_dev)); | 1419 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); |
| 1420 | } | 1420 | } |
| 1421 | 1421 | ||
| 1422 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1422 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c index edb24b0e337b..a9efbdfe5302 100644 --- a/drivers/net/ethernet/smsc/smsc9420.c +++ b/drivers/net/ethernet/smsc/smsc9420.c | |||
| @@ -279,9 +279,10 @@ static void smsc9420_ethtool_get_drvinfo(struct net_device *netdev, | |||
| 279 | { | 279 | { |
| 280 | struct smsc9420_pdata *pd = netdev_priv(netdev); | 280 | struct smsc9420_pdata *pd = netdev_priv(netdev); |
| 281 | 281 | ||
| 282 | strcpy(drvinfo->driver, DRV_NAME); | 282 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
| 283 | strcpy(drvinfo->bus_info, pci_name(pd->pdev)); | 283 | strlcpy(drvinfo->bus_info, pci_name(pd->pdev), |
| 284 | strcpy(drvinfo->version, DRV_VERSION); | 284 | sizeof(drvinfo->bus_info)); |
| 285 | strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); | ||
| 285 | } | 286 | } |
| 286 | 287 | ||
| 287 | static u32 smsc9420_ethtool_get_msglevel(struct net_device *netdev) | 288 | static u32 smsc9420_ethtool_get_msglevel(struct net_device *netdev) |
diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c index bbe8b7dbf3f3..33979c3ac943 100644 --- a/drivers/net/ethernet/xircom/xirc2ps_cs.c +++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c | |||
| @@ -1411,7 +1411,7 @@ do_open(struct net_device *dev) | |||
| 1411 | static void netdev_get_drvinfo(struct net_device *dev, | 1411 | static void netdev_get_drvinfo(struct net_device *dev, |
| 1412 | struct ethtool_drvinfo *info) | 1412 | struct ethtool_drvinfo *info) |
| 1413 | { | 1413 | { |
| 1414 | strcpy(info->driver, "xirc2ps_cs"); | 1414 | strlcpy(info->driver, "xirc2ps_cs", sizeof(info->driver)); |
| 1415 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 1415 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); |
| 1416 | } | 1416 | } |
| 1417 | 1417 | ||
