diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-01-05 19:44:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-07 00:06:31 -0500 |
commit | 7826d43f2db45c9305a6e0ba165650e1a203f517 (patch) | |
tree | a8659c995a37f58db809da9537aafac178431f31 /drivers/net | |
parent | 2afb9b533423a9b97f84181e773cf9361d98fed6 (diff) |
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>
Diffstat (limited to 'drivers/net')
68 files changed, 227 insertions, 207 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index c4952985c084..564cf4231f48 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4330,11 +4330,12 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4330 | } | 4330 | } |
4331 | 4331 | ||
4332 | static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, | 4332 | static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, |
4333 | struct ethtool_drvinfo *drvinfo) | 4333 | struct ethtool_drvinfo *drvinfo) |
4334 | { | 4334 | { |
4335 | strncpy(drvinfo->driver, DRV_NAME, 32); | 4335 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
4336 | strncpy(drvinfo->version, DRV_VERSION, 32); | 4336 | strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); |
4337 | snprintf(drvinfo->fw_version, 32, "%d", BOND_ABI_VERSION); | 4337 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d", |
4338 | BOND_ABI_VERSION); | ||
4338 | } | 4339 | } |
4339 | 4340 | ||
4340 | static const struct ethtool_ops bond_ethtool_ops = { | 4341 | static const struct ethtool_ops bond_ethtool_ops = { |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 021d69c5d9bc..29e272cc7a98 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -1448,10 +1448,10 @@ static int e100_set_settings(struct net_device *dev, | |||
1448 | static void e100_get_drvinfo(struct net_device *dev, | 1448 | static void e100_get_drvinfo(struct net_device *dev, |
1449 | struct ethtool_drvinfo *info) | 1449 | struct ethtool_drvinfo *info) |
1450 | { | 1450 | { |
1451 | strncpy(info->driver, "ETRAX 100LX", sizeof(info->driver) - 1); | 1451 | strlcpy(info->driver, "ETRAX 100LX", sizeof(info->driver)); |
1452 | strncpy(info->version, "$Revision: 1.31 $", sizeof(info->version) - 1); | 1452 | strlcpy(info->version, "$Revision: 1.31 $", sizeof(info->version)); |
1453 | strncpy(info->fw_version, "N/A", sizeof(info->fw_version) - 1); | 1453 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
1454 | strncpy(info->bus_info, "N/A", sizeof(info->bus_info) - 1); | 1454 | strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); |
1455 | } | 1455 | } |
1456 | 1456 | ||
1457 | static int e100_nway_reset(struct net_device *dev) | 1457 | static int e100_nway_reset(struct net_device *dev) |
diff --git a/drivers/net/ethernet/3com/3c501.c b/drivers/net/ethernet/3com/3c501.c index 2038eaabaea4..9abd9a738f8e 100644 --- a/drivers/net/ethernet/3com/3c501.c +++ b/drivers/net/ethernet/3com/3c501.c | |||
@@ -823,9 +823,10 @@ static void set_multicast_list(struct net_device *dev) | |||
823 | static void netdev_get_drvinfo(struct net_device *dev, | 823 | static void netdev_get_drvinfo(struct net_device *dev, |
824 | struct ethtool_drvinfo *info) | 824 | struct ethtool_drvinfo *info) |
825 | { | 825 | { |
826 | strcpy(info->driver, DRV_NAME); | 826 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
827 | strcpy(info->version, DRV_VERSION); | 827 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
828 | sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | 828 | snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", |
829 | dev->base_addr); | ||
829 | } | 830 | } |
830 | 831 | ||
831 | static u32 netdev_get_msglevel(struct net_device *dev) | 832 | static u32 netdev_get_msglevel(struct net_device *dev) |
diff --git a/drivers/net/ethernet/3com/3c509.c b/drivers/net/ethernet/3com/3c509.c index 633c709b9d99..f36ff99fd394 100644 --- a/drivers/net/ethernet/3com/3c509.c +++ b/drivers/net/ethernet/3com/3c509.c | |||
@@ -1161,8 +1161,8 @@ el3_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1161 | 1161 | ||
1162 | static void el3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1162 | static void el3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1163 | { | 1163 | { |
1164 | strcpy(info->driver, DRV_NAME); | 1164 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1165 | strcpy(info->version, DRV_VERSION); | 1165 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 1168 | static int el3_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c index 59e1e001bc3f..94c656f5a05d 100644 --- a/drivers/net/ethernet/3com/3c515.c +++ b/drivers/net/ethernet/3com/3c515.c | |||
@@ -1542,9 +1542,10 @@ static void set_rx_mode(struct net_device *dev) | |||
1542 | static void netdev_get_drvinfo(struct net_device *dev, | 1542 | static void netdev_get_drvinfo(struct net_device *dev, |
1543 | struct ethtool_drvinfo *info) | 1543 | struct ethtool_drvinfo *info) |
1544 | { | 1544 | { |
1545 | strcpy(info->driver, DRV_NAME); | 1545 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1546 | strcpy(info->version, DRV_VERSION); | 1546 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1547 | sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | 1547 | snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", |
1548 | dev->base_addr); | ||
1548 | } | 1549 | } |
1549 | 1550 | ||
1550 | static u32 netdev_get_msglevel(struct net_device *dev) | 1551 | static u32 netdev_get_msglevel(struct net_device *dev) |
diff --git a/drivers/net/ethernet/8390/3c503.c b/drivers/net/ethernet/8390/3c503.c index 49d76bd0dc86..0e9afe7b61a4 100644 --- a/drivers/net/ethernet/8390/3c503.c +++ b/drivers/net/ethernet/8390/3c503.c | |||
@@ -695,9 +695,10 @@ el2_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring | |||
695 | static void netdev_get_drvinfo(struct net_device *dev, | 695 | static void netdev_get_drvinfo(struct net_device *dev, |
696 | struct ethtool_drvinfo *info) | 696 | struct ethtool_drvinfo *info) |
697 | { | 697 | { |
698 | strcpy(info->driver, DRV_NAME); | 698 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
699 | strcpy(info->version, DRV_VERSION); | 699 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
700 | sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | 700 | snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", |
701 | dev->base_addr); | ||
701 | } | 702 | } |
702 | 703 | ||
703 | static const struct ethtool_ops netdev_ethtool_ops = { | 704 | static const struct ethtool_ops netdev_ethtool_ops = { |
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 70dba5d01ad3..7eeddf01307f 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c | |||
@@ -469,9 +469,9 @@ static void ax_get_drvinfo(struct net_device *dev, | |||
469 | { | 469 | { |
470 | struct platform_device *pdev = to_platform_device(dev->dev.parent); | 470 | struct platform_device *pdev = to_platform_device(dev->dev.parent); |
471 | 471 | ||
472 | strcpy(info->driver, DRV_NAME); | 472 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
473 | strcpy(info->version, DRV_VERSION); | 473 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
474 | strcpy(info->bus_info, pdev->name); | 474 | strlcpy(info->bus_info, pdev->name, sizeof(info->bus_info)); |
475 | } | 475 | } |
476 | 476 | ||
477 | static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 477 | static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c index 8c3c9cfbf864..c7a83f6f2382 100644 --- a/drivers/net/ethernet/adi/bfin_mac.c +++ b/drivers/net/ethernet/adi/bfin_mac.c | |||
@@ -498,10 +498,10 @@ bfin_mac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
498 | static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev, | 498 | static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev, |
499 | struct ethtool_drvinfo *info) | 499 | struct ethtool_drvinfo *info) |
500 | { | 500 | { |
501 | strcpy(info->driver, KBUILD_MODNAME); | 501 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
502 | strcpy(info->version, DRV_VERSION); | 502 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
503 | strcpy(info->fw_version, "N/A"); | 503 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
504 | strcpy(info->bus_info, dev_name(&dev->dev)); | 504 | strlcpy(info->bus_info, dev_name(&dev->dev), sizeof(info->bus_info)); |
505 | } | 505 | } |
506 | 506 | ||
507 | static void bfin_mac_ethtool_getwol(struct net_device *dev, | 507 | static void bfin_mac_ethtool_getwol(struct net_device *dev, |
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index aa53115bb38b..480662ba5227 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c | |||
@@ -1127,10 +1127,11 @@ static void greth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in | |||
1127 | { | 1127 | { |
1128 | struct greth_private *greth = netdev_priv(dev); | 1128 | struct greth_private *greth = netdev_priv(dev); |
1129 | 1129 | ||
1130 | strncpy(info->driver, dev_driver_string(greth->dev), 32); | 1130 | strlcpy(info->driver, dev_driver_string(greth->dev), |
1131 | strncpy(info->version, "revision: 1.0", 32); | 1131 | sizeof(info->driver)); |
1132 | strncpy(info->bus_info, greth->dev->bus->name, 32); | 1132 | strlcpy(info->version, "revision: 1.0", sizeof(info->version)); |
1133 | strncpy(info->fw_version, "N/A", 32); | 1133 | strlcpy(info->bus_info, greth->dev->bus->name, sizeof(info->bus_info)); |
1134 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); | ||
1134 | info->eedump_len = 0; | 1135 | info->eedump_len = 0; |
1135 | info->regdump_len = sizeof(struct greth_regs); | 1136 | info->regdump_len = sizeof(struct greth_regs); |
1136 | } | 1137 | } |
diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c index 2ea221ed4777..65b865a0cc78 100644 --- a/drivers/net/ethernet/amd/au1000_eth.c +++ b/drivers/net/ethernet/amd/au1000_eth.c | |||
@@ -587,10 +587,10 @@ au1000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
587 | { | 587 | { |
588 | struct au1000_private *aup = netdev_priv(dev); | 588 | struct au1000_private *aup = netdev_priv(dev); |
589 | 589 | ||
590 | strcpy(info->driver, DRV_NAME); | 590 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
591 | strcpy(info->version, DRV_VERSION); | 591 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
592 | info->fw_version[0] = '\0'; | 592 | snprintf(info->bus_info, sizeof(info->bus_info), "%s %d", DRV_NAME, |
593 | sprintf(info->bus_info, "%s %d", DRV_NAME, aup->mac_id); | 593 | aup->mac_id); |
594 | info->regdump_len = 0; | 594 | info->regdump_len = 0; |
595 | } | 595 | } |
596 | 596 | ||
diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c index c2d696c88e46..6a40290d3727 100644 --- a/drivers/net/ethernet/amd/sunlance.c +++ b/drivers/net/ethernet/amd/sunlance.c | |||
@@ -1284,8 +1284,8 @@ static void lance_free_hwresources(struct lance_private *lp) | |||
1284 | /* Ethtool support... */ | 1284 | /* Ethtool support... */ |
1285 | static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1285 | static void sparc_lance_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1286 | { | 1286 | { |
1287 | strcpy(info->driver, "sunlance"); | 1287 | strlcpy(info->driver, "sunlance", sizeof(info->driver)); |
1288 | strcpy(info->version, "2.02"); | 1288 | strlcpy(info->version, "2.02", sizeof(info->version)); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | static const struct ethtool_ops sparc_lance_ethtool_ops = { | 1291 | static const struct ethtool_ops sparc_lance_ethtool_ops = { |
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 39387d67b722..d8a151046728 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c | |||
@@ -1227,10 +1227,11 @@ static const u32 unused_mib_regs[] = { | |||
1227 | static void bcm_enet_get_drvinfo(struct net_device *netdev, | 1227 | static void bcm_enet_get_drvinfo(struct net_device *netdev, |
1228 | struct ethtool_drvinfo *drvinfo) | 1228 | struct ethtool_drvinfo *drvinfo) |
1229 | { | 1229 | { |
1230 | strncpy(drvinfo->driver, bcm_enet_driver_name, 32); | 1230 | strlcpy(drvinfo->driver, bcm_enet_driver_name, sizeof(drvinfo->driver)); |
1231 | strncpy(drvinfo->version, bcm_enet_driver_version, 32); | 1231 | strlcpy(drvinfo->version, bcm_enet_driver_version, |
1232 | strncpy(drvinfo->fw_version, "N/A", 32); | 1232 | sizeof(drvinfo->version)); |
1233 | strncpy(drvinfo->bus_info, "bcm63xx", 32); | 1233 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
1234 | strlcpy(drvinfo->bus_info, "bcm63xx", sizeof(drvinfo->bus_info)); | ||
1234 | drvinfo->n_stats = BCM_ENET_STATS_LEN; | 1235 | drvinfo->n_stats = BCM_ENET_STATS_LEN; |
1235 | } | 1236 | } |
1236 | 1237 | ||
diff --git a/drivers/net/ethernet/cirrus/ep93xx_eth.c b/drivers/net/ethernet/cirrus/ep93xx_eth.c index 78c55213eaf7..354cbb78ed50 100644 --- a/drivers/net/ethernet/cirrus/ep93xx_eth.c +++ b/drivers/net/ethernet/cirrus/ep93xx_eth.c | |||
@@ -710,8 +710,8 @@ static int ep93xx_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
710 | 710 | ||
711 | static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 711 | static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
712 | { | 712 | { |
713 | strcpy(info->driver, DRV_MODULE_NAME); | 713 | strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); |
714 | strcpy(info->version, DRV_MODULE_VERSION); | 714 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
715 | } | 715 | } |
716 | 716 | ||
717 | static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 717 | static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index c73472c369cd..8cdf02503d13 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -434,9 +434,10 @@ static void dm9000_get_drvinfo(struct net_device *dev, | |||
434 | { | 434 | { |
435 | board_info_t *dm = to_dm9000_board(dev); | 435 | board_info_t *dm = to_dm9000_board(dev); |
436 | 436 | ||
437 | strcpy(info->driver, CARDNAME); | 437 | strlcpy(info->driver, CARDNAME, sizeof(info->driver)); |
438 | strcpy(info->version, DRV_VERSION); | 438 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
439 | strcpy(info->bus_info, to_platform_device(dm->dev)->name); | 439 | strlcpy(info->bus_info, to_platform_device(dm->dev)->name, |
440 | sizeof(info->bus_info)); | ||
440 | } | 441 | } |
441 | 442 | ||
442 | static u32 dm9000_get_msglevel(struct net_device *dev) | 443 | static u32 dm9000_get_msglevel(struct net_device *dev) |
diff --git a/drivers/net/ethernet/dec/ewrk3.c b/drivers/net/ethernet/dec/ewrk3.c index 9f992b95eddc..501517226f63 100644 --- a/drivers/net/ethernet/dec/ewrk3.c +++ b/drivers/net/ethernet/dec/ewrk3.c | |||
@@ -1506,10 +1506,10 @@ static void ewrk3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *in | |||
1506 | { | 1506 | { |
1507 | int fwrev = Read_EEPROM(dev->base_addr, EEPROM_REVLVL); | 1507 | int fwrev = Read_EEPROM(dev->base_addr, EEPROM_REVLVL); |
1508 | 1508 | ||
1509 | strcpy(info->driver, DRV_NAME); | 1509 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1510 | strcpy(info->version, DRV_VERSION); | 1510 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1511 | sprintf(info->fw_version, "%d", fwrev); | 1511 | snprintf(info->fw_version, sizeof(info->fw_version), "%d", fwrev); |
1512 | strcpy(info->bus_info, "N/A"); | 1512 | strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); |
1513 | info->eedump_len = EEPROM_MAX; | 1513 | info->eedump_len = EEPROM_MAX; |
1514 | } | 1514 | } |
1515 | 1515 | ||
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c index 1d342d37915c..110d26f4c602 100644 --- a/drivers/net/ethernet/dlink/dl2k.c +++ b/drivers/net/ethernet/dlink/dl2k.c | |||
@@ -1156,9 +1156,10 @@ set_multicast (struct net_device *dev) | |||
1156 | static void rio_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1156 | static void rio_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1157 | { | 1157 | { |
1158 | struct netdev_private *np = netdev_priv(dev); | 1158 | struct netdev_private *np = netdev_priv(dev); |
1159 | strcpy(info->driver, "dl2k"); | 1159 | |
1160 | strcpy(info->version, DRV_VERSION); | 1160 | strlcpy(info->driver, "dl2k", sizeof(info->driver)); |
1161 | strcpy(info->bus_info, pci_name(np->pdev)); | 1161 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1162 | strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); | ||
1162 | } | 1163 | } |
1163 | 1164 | ||
1164 | static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1165 | static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index 00454a10f88d..76b302f30c87 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
@@ -183,12 +183,12 @@ static void be_get_drvinfo(struct net_device *netdev, | |||
183 | 183 | ||
184 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); | 184 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
185 | strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version)); | 185 | strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version)); |
186 | strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN); | 186 | if (!memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN)) |
187 | if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) { | 187 | strlcpy(drvinfo->fw_version, adapter->fw_ver, |
188 | strcat(drvinfo->fw_version, " ["); | 188 | sizeof(drvinfo->fw_version)); |
189 | strcat(drvinfo->fw_version, fw_on_flash); | 189 | else |
190 | strcat(drvinfo->fw_version, "]"); | 190 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), |
191 | } | 191 | "%s [%s]", adapter->fw_ver, fw_on_flash); |
192 | 192 | ||
193 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), | 193 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
194 | sizeof(drvinfo->bus_info)); | 194 | sizeof(drvinfo->bus_info)); |
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 74d749e29aab..96454b5fca63 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c | |||
@@ -955,9 +955,9 @@ static int ftgmac100_mdiobus_reset(struct mii_bus *bus) | |||
955 | static void ftgmac100_get_drvinfo(struct net_device *netdev, | 955 | static void ftgmac100_get_drvinfo(struct net_device *netdev, |
956 | struct ethtool_drvinfo *info) | 956 | struct ethtool_drvinfo *info) |
957 | { | 957 | { |
958 | strcpy(info->driver, DRV_NAME); | 958 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
959 | strcpy(info->version, DRV_VERSION); | 959 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
960 | strcpy(info->bus_info, dev_name(&netdev->dev)); | 960 | strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info)); |
961 | } | 961 | } |
962 | 962 | ||
963 | static int ftgmac100_get_settings(struct net_device *netdev, | 963 | static int ftgmac100_get_settings(struct net_device *netdev, |
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c index b901a01e3fa5..b5ea8fbd8a76 100644 --- a/drivers/net/ethernet/faraday/ftmac100.c +++ b/drivers/net/ethernet/faraday/ftmac100.c | |||
@@ -820,9 +820,9 @@ static void ftmac100_mdio_write(struct net_device *netdev, int phy_id, int reg, | |||
820 | static void ftmac100_get_drvinfo(struct net_device *netdev, | 820 | static void ftmac100_get_drvinfo(struct net_device *netdev, |
821 | struct ethtool_drvinfo *info) | 821 | struct ethtool_drvinfo *info) |
822 | { | 822 | { |
823 | strcpy(info->driver, DRV_NAME); | 823 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
824 | strcpy(info->version, DRV_VERSION); | 824 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
825 | strcpy(info->bus_info, dev_name(&netdev->dev)); | 825 | strlcpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info)); |
826 | } | 826 | } |
827 | 827 | ||
828 | static int ftmac100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | 828 | static int ftmac100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index a3793190437f..0a9748b64c24 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -1168,9 +1168,10 @@ static void fec_enet_get_drvinfo(struct net_device *ndev, | |||
1168 | { | 1168 | { |
1169 | struct fec_enet_private *fep = netdev_priv(ndev); | 1169 | struct fec_enet_private *fep = netdev_priv(ndev); |
1170 | 1170 | ||
1171 | strcpy(info->driver, fep->pdev->dev.driver->name); | 1171 | strlcpy(info->driver, fep->pdev->dev.driver->name, |
1172 | strcpy(info->version, "Revision: 1.0"); | 1172 | sizeof(info->driver)); |
1173 | strcpy(info->bus_info, dev_name(&ndev->dev)); | 1173 | strlcpy(info->version, "Revision: 1.0", sizeof(info->version)); |
1174 | strlcpy(info->bus_info, dev_name(&ndev->dev), sizeof(info->bus_info)); | ||
1174 | } | 1175 | } |
1175 | 1176 | ||
1176 | static const struct ethtool_ops fec_enet_ethtool_ops = { | 1177 | static const struct ethtool_ops fec_enet_ethtool_ops = { |
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index e9879c5af7ba..46df28893c10 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | |||
@@ -888,8 +888,8 @@ static struct net_device_stats *fs_enet_get_stats(struct net_device *dev) | |||
888 | static void fs_get_drvinfo(struct net_device *dev, | 888 | static void fs_get_drvinfo(struct net_device *dev, |
889 | struct ethtool_drvinfo *info) | 889 | struct ethtool_drvinfo *info) |
890 | { | 890 | { |
891 | strcpy(info->driver, DRV_MODULE_NAME); | 891 | strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); |
892 | strcpy(info->version, DRV_MODULE_VERSION); | 892 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
893 | } | 893 | } |
894 | 894 | ||
895 | static int fs_get_regs_len(struct net_device *dev) | 895 | static int fs_get_regs_len(struct net_device *dev) |
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h index 22eabc13ca99..1b6a67cf8bf6 100644 --- a/drivers/net/ethernet/freescale/gianfar.h +++ b/drivers/net/ethernet/freescale/gianfar.h | |||
@@ -649,8 +649,6 @@ struct gfar_extra_stats { | |||
649 | /* Number of stats in the stats structure (ignore car and cam regs)*/ | 649 | /* Number of stats in the stats structure (ignore car and cam regs)*/ |
650 | #define GFAR_STATS_LEN (GFAR_RMON_LEN + GFAR_EXTRA_STATS_LEN) | 650 | #define GFAR_STATS_LEN (GFAR_RMON_LEN + GFAR_EXTRA_STATS_LEN) |
651 | 651 | ||
652 | #define GFAR_INFOSTR_LEN 32 | ||
653 | |||
654 | struct gfar_stats { | 652 | struct gfar_stats { |
655 | u64 extra[GFAR_EXTRA_STATS_LEN]; | 653 | u64 extra[GFAR_EXTRA_STATS_LEN]; |
656 | u64 rmon[GFAR_RMON_LEN]; | 654 | u64 rmon[GFAR_RMON_LEN]; |
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index ab6762caa957..d0fe53c5b297 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c | |||
@@ -184,10 +184,11 @@ static int gfar_sset_count(struct net_device *dev, int sset) | |||
184 | static void gfar_gdrvinfo(struct net_device *dev, | 184 | static void gfar_gdrvinfo(struct net_device *dev, |
185 | struct ethtool_drvinfo *drvinfo) | 185 | struct ethtool_drvinfo *drvinfo) |
186 | { | 186 | { |
187 | strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN); | 187 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
188 | strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN); | 188 | strlcpy(drvinfo->version, gfar_driver_version, |
189 | strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN); | 189 | sizeof(drvinfo->version)); |
190 | strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN); | 190 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
191 | strlcpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info)); | ||
191 | drvinfo->regdump_len = 0; | 192 | drvinfo->regdump_len = 0; |
192 | drvinfo->eedump_len = 0; | 193 | drvinfo->eedump_len = 0; |
193 | } | 194 | } |
diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c index 37b035306013..1ebf7128ec04 100644 --- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c +++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c | |||
@@ -350,10 +350,10 @@ static void | |||
350 | uec_get_drvinfo(struct net_device *netdev, | 350 | uec_get_drvinfo(struct net_device *netdev, |
351 | struct ethtool_drvinfo *drvinfo) | 351 | struct ethtool_drvinfo *drvinfo) |
352 | { | 352 | { |
353 | strncpy(drvinfo->driver, DRV_NAME, 32); | 353 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
354 | strncpy(drvinfo->version, DRV_VERSION, 32); | 354 | strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); |
355 | strncpy(drvinfo->fw_version, "N/A", 32); | 355 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
356 | strncpy(drvinfo->bus_info, "QUICC ENGINE", 32); | 356 | strlcpy(drvinfo->bus_info, "QUICC ENGINE", sizeof(drvinfo->bus_info)); |
357 | drvinfo->eedump_len = 0; | 357 | drvinfo->eedump_len = 0; |
358 | drvinfo->regdump_len = uec_get_regs_len(netdev); | 358 | drvinfo->regdump_len = uec_get_regs_len(netdev); |
359 | } | 359 | } |
diff --git a/drivers/net/ethernet/i825xx/3c505.c b/drivers/net/ethernet/i825xx/3c505.c index 6a5c21b82c51..6d000d678a58 100644 --- a/drivers/net/ethernet/i825xx/3c505.c +++ b/drivers/net/ethernet/i825xx/3c505.c | |||
@@ -1138,9 +1138,10 @@ static struct net_device_stats *elp_get_stats(struct net_device *dev) | |||
1138 | static void netdev_get_drvinfo(struct net_device *dev, | 1138 | static void netdev_get_drvinfo(struct net_device *dev, |
1139 | struct ethtool_drvinfo *info) | 1139 | struct ethtool_drvinfo *info) |
1140 | { | 1140 | { |
1141 | strcpy(info->driver, DRV_NAME); | 1141 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1142 | strcpy(info->version, DRV_VERSION); | 1142 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1143 | sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | 1143 | snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", |
1144 | dev->base_addr); | ||
1144 | } | 1145 | } |
1145 | 1146 | ||
1146 | static u32 netdev_get_msglevel(struct net_device *dev) | 1147 | static u32 netdev_get_msglevel(struct net_device *dev) |
diff --git a/drivers/net/ethernet/i825xx/3c507.c b/drivers/net/ethernet/i825xx/3c507.c index e8984b059905..13983ee6bcf8 100644 --- a/drivers/net/ethernet/i825xx/3c507.c +++ b/drivers/net/ethernet/i825xx/3c507.c | |||
@@ -888,9 +888,10 @@ static void el16_rx(struct net_device *dev) | |||
888 | static void netdev_get_drvinfo(struct net_device *dev, | 888 | static void netdev_get_drvinfo(struct net_device *dev, |
889 | struct ethtool_drvinfo *info) | 889 | struct ethtool_drvinfo *info) |
890 | { | 890 | { |
891 | strcpy(info->driver, DRV_NAME); | 891 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
892 | strcpy(info->version, DRV_VERSION); | 892 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
893 | sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr); | 893 | snprintf(info->bus_info, sizeof(info->bus_info), "ISA 0x%lx", |
894 | dev->base_addr); | ||
894 | } | 895 | } |
895 | 896 | ||
896 | static u32 netdev_get_msglevel(struct net_device *dev) | 897 | static u32 netdev_get_msglevel(struct net_device *dev) |
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 256bdb8e1994..4989481c19f0 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c | |||
@@ -2190,11 +2190,10 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev, | |||
2190 | { | 2190 | { |
2191 | struct emac_instance *dev = netdev_priv(ndev); | 2191 | struct emac_instance *dev = netdev_priv(ndev); |
2192 | 2192 | ||
2193 | strcpy(info->driver, "ibm_emac"); | 2193 | strlcpy(info->driver, "ibm_emac", sizeof(info->driver)); |
2194 | strcpy(info->version, DRV_VERSION); | 2194 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
2195 | info->fw_version[0] = '\0'; | 2195 | snprintf(info->bus_info, sizeof(info->bus_info), "PPC 4xx EMAC-%d %s", |
2196 | sprintf(info->bus_info, "PPC 4xx EMAC-%d %s", | 2196 | dev->cell_index, dev->ofdev->dev.of_node->full_name); |
2197 | dev->cell_index, dev->ofdev->dev.of_node->full_name); | ||
2198 | info->regdump_len = emac_ethtool_get_regs_len(ndev); | 2197 | info->regdump_len = emac_ethtool_get_regs_len(ndev); |
2199 | } | 2198 | } |
2200 | 2199 | ||
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index f2fdbb79837e..4181f6e99c00 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
@@ -722,9 +722,8 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
722 | static void netdev_get_drvinfo(struct net_device *dev, | 722 | static void netdev_get_drvinfo(struct net_device *dev, |
723 | struct ethtool_drvinfo *info) | 723 | struct ethtool_drvinfo *info) |
724 | { | 724 | { |
725 | strncpy(info->driver, ibmveth_driver_name, sizeof(info->driver) - 1); | 725 | strlcpy(info->driver, ibmveth_driver_name, sizeof(info->driver)); |
726 | strncpy(info->version, ibmveth_driver_version, | 726 | strlcpy(info->version, ibmveth_driver_version, sizeof(info->version)); |
727 | sizeof(info->version) - 1); | ||
728 | } | 727 | } |
729 | 728 | ||
730 | static netdev_features_t ibmveth_fix_features(struct net_device *dev, | 729 | static netdev_features_t ibmveth_fix_features(struct net_device *dev, |
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c index bc58f1dc22f5..5409fe876a44 100644 --- a/drivers/net/ethernet/korina.c +++ b/drivers/net/ethernet/korina.c | |||
@@ -695,9 +695,9 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
695 | { | 695 | { |
696 | struct korina_private *lp = netdev_priv(dev); | 696 | struct korina_private *lp = netdev_priv(dev); |
697 | 697 | ||
698 | strcpy(info->driver, DRV_NAME); | 698 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
699 | strcpy(info->version, DRV_VERSION); | 699 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
700 | strcpy(info->bus_info, lp->dev->name); | 700 | strlcpy(info->bus_info, lp->dev->name, sizeof(info->bus_info)); |
701 | } | 701 | } |
702 | 702 | ||
703 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 703 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index cd3d2c09cdd0..8ead46adc21e 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
@@ -302,9 +302,9 @@ ltq_etop_hw_init(struct net_device *dev) | |||
302 | static void | 302 | static void |
303 | ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 303 | ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
304 | { | 304 | { |
305 | strcpy(info->driver, "Lantiq ETOP"); | 305 | strlcpy(info->driver, "Lantiq ETOP", sizeof(info->driver)); |
306 | strcpy(info->bus_info, "internal"); | 306 | strlcpy(info->bus_info, "internal", sizeof(info->bus_info)); |
307 | strcpy(info->version, DRV_VERSION); | 307 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
308 | } | 308 | } |
309 | 309 | ||
310 | static int | 310 | static int |
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index aa037ca314e7..c7f2fa60fe6f 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
@@ -1443,10 +1443,10 @@ static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1443 | static void pxa168_get_drvinfo(struct net_device *dev, | 1443 | static void pxa168_get_drvinfo(struct net_device *dev, |
1444 | struct ethtool_drvinfo *info) | 1444 | struct ethtool_drvinfo *info) |
1445 | { | 1445 | { |
1446 | strncpy(info->driver, DRIVER_NAME, 32); | 1446 | strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); |
1447 | strncpy(info->version, DRIVER_VERSION, 32); | 1447 | strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); |
1448 | strncpy(info->fw_version, "N/A", 32); | 1448 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
1449 | strncpy(info->bus_info, "N/A", 32); | 1449 | strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); |
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | static const struct ethtool_ops pxa168_ethtool_ops = { | 1452 | static const struct ethtool_ops pxa168_ethtool_ops = { |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-ethtool.c b/drivers/net/ethernet/neterion/vxge/vxge-ethtool.c index 92dd72d3f9de..f8f073880f84 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-ethtool.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-ethtool.c | |||
@@ -82,9 +82,9 @@ static void vxge_ethtool_gdrvinfo(struct net_device *dev, | |||
82 | struct ethtool_drvinfo *info) | 82 | struct ethtool_drvinfo *info) |
83 | { | 83 | { |
84 | struct vxgedev *vdev = netdev_priv(dev); | 84 | struct vxgedev *vdev = netdev_priv(dev); |
85 | strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME)); | 85 | strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(info->driver)); |
86 | strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION)); | 86 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
87 | strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN); | 87 | strlcpy(info->fw_version, vdev->fw_version, sizeof(info->fw_version)); |
88 | strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info)); | 88 | strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info)); |
89 | info->regdump_len = sizeof(struct vxge_hw_vpath_reg) | 89 | info->regdump_len = sizeof(struct vxge_hw_vpath_reg) |
90 | * vdev->no_of_vpath; | 90 | * vdev->no_of_vpath; |
diff --git a/drivers/net/ethernet/nuvoton/w90p910_ether.c b/drivers/net/ethernet/nuvoton/w90p910_ether.c index cbd6a529d0c0..162da8975b05 100644 --- a/drivers/net/ethernet/nuvoton/w90p910_ether.c +++ b/drivers/net/ethernet/nuvoton/w90p910_ether.c | |||
@@ -878,8 +878,8 @@ static int w90p910_ether_ioctl(struct net_device *dev, | |||
878 | static void w90p910_get_drvinfo(struct net_device *dev, | 878 | static void w90p910_get_drvinfo(struct net_device *dev, |
879 | struct ethtool_drvinfo *info) | 879 | struct ethtool_drvinfo *info) |
880 | { | 880 | { |
881 | strcpy(info->driver, DRV_MODULE_NAME); | 881 | strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); |
882 | strcpy(info->version, DRV_MODULE_VERSION); | 882 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
883 | } | 883 | } |
884 | 884 | ||
885 | static int w90p910_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 885 | static int w90p910_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 3466ca1e8f6c..6fda51ebcc76 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1239,9 +1239,10 @@ static int lpc_eth_open(struct net_device *ndev) | |||
1239 | static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev, | 1239 | static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev, |
1240 | struct ethtool_drvinfo *info) | 1240 | struct ethtool_drvinfo *info) |
1241 | { | 1241 | { |
1242 | strcpy(info->driver, MODNAME); | 1242 | strlcpy(info->driver, MODNAME, sizeof(info->driver)); |
1243 | strcpy(info->version, DRV_VERSION); | 1243 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1244 | strcpy(info->bus_info, dev_name(ndev->dev.parent)); | 1244 | strlcpy(info->bus_info, dev_name(ndev->dev.parent), |
1245 | sizeof(info->bus_info)); | ||
1245 | } | 1246 | } |
1246 | 1247 | ||
1247 | static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev) | 1248 | static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev) |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index b4a842c3b5c4..921729f9c85c 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
@@ -1350,10 +1350,10 @@ static void octeon_mgmt_poll_controller(struct net_device *netdev) | |||
1350 | static void octeon_mgmt_get_drvinfo(struct net_device *netdev, | 1350 | static void octeon_mgmt_get_drvinfo(struct net_device *netdev, |
1351 | struct ethtool_drvinfo *info) | 1351 | struct ethtool_drvinfo *info) |
1352 | { | 1352 | { |
1353 | strncpy(info->driver, DRV_NAME, sizeof(info->driver)); | 1353 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1354 | strncpy(info->version, DRV_VERSION, sizeof(info->version)); | 1354 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1355 | strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); | 1355 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
1356 | strncpy(info->bus_info, "N/A", sizeof(info->bus_info)); | 1356 | strlcpy(info->bus_info, "N/A", sizeof(info->bus_info)); |
1357 | info->n_stats = 0; | 1357 | info->n_stats = 0; |
1358 | info->testinfo_len = 0; | 1358 | info->testinfo_len = 0; |
1359 | info->regdump_len = 0; | 1359 | info->regdump_len = 0; |
diff --git a/drivers/net/ethernet/packetengines/hamachi.c b/drivers/net/ethernet/packetengines/hamachi.c index bf829ee30077..cac33e5f9bc2 100644 --- a/drivers/net/ethernet/packetengines/hamachi.c +++ b/drivers/net/ethernet/packetengines/hamachi.c | |||
@@ -1808,9 +1808,10 @@ static int check_if_running(struct net_device *dev) | |||
1808 | static void hamachi_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1808 | static void hamachi_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1809 | { | 1809 | { |
1810 | struct hamachi_private *np = netdev_priv(dev); | 1810 | struct hamachi_private *np = netdev_priv(dev); |
1811 | strcpy(info->driver, DRV_NAME); | 1811 | |
1812 | strcpy(info->version, DRV_VERSION); | 1812 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1813 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 1813 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1814 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); | ||
1814 | } | 1815 | } |
1815 | 1816 | ||
1816 | static int hamachi_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 1817 | static int hamachi_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/ethernet/packetengines/yellowfin.c b/drivers/net/ethernet/packetengines/yellowfin.c index fbaed4fa72fa..d28593b1fc3e 100644 --- a/drivers/net/ethernet/packetengines/yellowfin.c +++ b/drivers/net/ethernet/packetengines/yellowfin.c | |||
@@ -1326,9 +1326,10 @@ static void set_rx_mode(struct net_device *dev) | |||
1326 | static void yellowfin_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1326 | static void yellowfin_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1327 | { | 1327 | { |
1328 | struct yellowfin_private *np = netdev_priv(dev); | 1328 | struct yellowfin_private *np = netdev_priv(dev); |
1329 | strcpy(info->driver, DRV_NAME); | 1329 | |
1330 | strcpy(info->version, DRV_VERSION); | 1330 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1331 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 1331 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1332 | strlcpy(info->bus_info, pci_name(np->pci_dev), sizeof(info->bus_info)); | ||
1332 | } | 1333 | } |
1333 | 1334 | ||
1334 | static const struct ethtool_ops ethtool_ops = { | 1335 | static const struct ethtool_ops ethtool_ops = { |
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c index 63c13125db6c..ba0be4b943dd 100644 --- a/drivers/net/ethernet/rdc/r6040.c +++ b/drivers/net/ethernet/rdc/r6040.c | |||
@@ -957,9 +957,9 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
957 | { | 957 | { |
958 | struct r6040_private *rp = netdev_priv(dev); | 958 | struct r6040_private *rp = netdev_priv(dev); |
959 | 959 | ||
960 | strcpy(info->driver, DRV_NAME); | 960 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
961 | strcpy(info->version, DRV_VERSION); | 961 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
962 | strcpy(info->bus_info, pci_name(rp->pdev)); | 962 | strlcpy(info->bus_info, pci_name(rp->pdev), sizeof(info->bus_info)); |
963 | } | 963 | } |
964 | 964 | ||
965 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 965 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c index dc171b4961e4..7ed08c32a9c5 100644 --- a/drivers/net/ethernet/sgi/ioc3-eth.c +++ b/drivers/net/ethernet/sgi/ioc3-eth.c | |||
@@ -1565,9 +1565,9 @@ static void ioc3_get_drvinfo (struct net_device *dev, | |||
1565 | { | 1565 | { |
1566 | struct ioc3_private *ip = netdev_priv(dev); | 1566 | struct ioc3_private *ip = netdev_priv(dev); |
1567 | 1567 | ||
1568 | strcpy (info->driver, IOC3_NAME); | 1568 | strlcpy(info->driver, IOC3_NAME, sizeof(info->driver)); |
1569 | strcpy (info->version, IOC3_VERSION); | 1569 | strlcpy(info->version, IOC3_VERSION, sizeof(info->version)); |
1570 | strcpy (info->bus_info, pci_name(ip->pdev)); | 1570 | strlcpy(info->bus_info, pci_name(ip->pdev), sizeof(info->bus_info)); |
1571 | } | 1571 | } |
1572 | 1572 | ||
1573 | static int ioc3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1573 | static int ioc3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c index 59a6f88da867..1538d5442bab 100644 --- a/drivers/net/ethernet/smsc/smc911x.c +++ b/drivers/net/ethernet/smsc/smc911x.c | |||
@@ -1522,9 +1522,10 @@ smc911x_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1522 | static void | 1522 | static void |
1523 | smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1523 | smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1524 | { | 1524 | { |
1525 | strncpy(info->driver, CARDNAME, sizeof(info->driver)); | 1525 | strlcpy(info->driver, CARDNAME, sizeof(info->driver)); |
1526 | strncpy(info->version, version, sizeof(info->version)); | 1526 | strlcpy(info->version, version, sizeof(info->version)); |
1527 | strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); | 1527 | strlcpy(info->bus_info, dev_name(dev->dev.parent), |
1528 | sizeof(info->bus_info)); | ||
1528 | } | 1529 | } |
1529 | 1530 | ||
1530 | static int smc911x_ethtool_nwayreset(struct net_device *dev) | 1531 | static int smc911x_ethtool_nwayreset(struct net_device *dev) |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index a670d23d9340..591650a8de38 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
@@ -1597,9 +1597,10 @@ smc_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1597 | static void | 1597 | static void |
1598 | smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1598 | smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1599 | { | 1599 | { |
1600 | strncpy(info->driver, CARDNAME, sizeof(info->driver)); | 1600 | strlcpy(info->driver, CARDNAME, sizeof(info->driver)); |
1601 | strncpy(info->version, version, sizeof(info->version)); | 1601 | strlcpy(info->version, version, sizeof(info->version)); |
1602 | strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); | 1602 | strlcpy(info->bus_info, dev_name(dev->dev.parent), |
1603 | sizeof(info->bus_info)); | ||
1603 | } | 1604 | } |
1604 | 1605 | ||
1605 | static int smc_ethtool_nwayreset(struct net_device *dev) | 1606 | static int smc_ethtool_nwayreset(struct net_device *dev) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 1372ce210b58..d1ac39c1b05d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | |||
@@ -210,8 +210,7 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev, | |||
210 | strlcpy(info->driver, MAC100_ETHTOOL_NAME, | 210 | strlcpy(info->driver, MAC100_ETHTOOL_NAME, |
211 | sizeof(info->driver)); | 211 | sizeof(info->driver)); |
212 | 212 | ||
213 | strcpy(info->version, DRV_MODULE_VERSION); | 213 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
214 | info->fw_version[0] = '\0'; | ||
215 | } | 214 | } |
216 | 215 | ||
217 | static int stmmac_ethtool_getsettings(struct net_device *dev, | 216 | static int stmmac_ethtool_getsettings(struct net_device *dev, |
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c index be82f6d13c51..5fafca065305 100644 --- a/drivers/net/ethernet/sun/sunbmac.c +++ b/drivers/net/ethernet/sun/sunbmac.c | |||
@@ -1042,8 +1042,8 @@ static void bigmac_set_multicast(struct net_device *dev) | |||
1042 | /* Ethtool support... */ | 1042 | /* Ethtool support... */ |
1043 | static void bigmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1043 | static void bigmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1044 | { | 1044 | { |
1045 | strcpy(info->driver, "sunbmac"); | 1045 | strlcpy(info->driver, "sunbmac", sizeof(info->driver)); |
1046 | strcpy(info->version, "2.0"); | 1046 | strlcpy(info->version, "2.0", sizeof(info->version)); |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | static u32 bigmac_get_link(struct net_device *dev) | 1049 | static u32 bigmac_get_link(struct net_device *dev) |
diff --git a/drivers/net/ethernet/sun/sunqe.c b/drivers/net/ethernet/sun/sunqe.c index 1dcee6915843..49bf3e2eb652 100644 --- a/drivers/net/ethernet/sun/sunqe.c +++ b/drivers/net/ethernet/sun/sunqe.c | |||
@@ -685,13 +685,14 @@ static void qe_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
685 | struct sunqe *qep = netdev_priv(dev); | 685 | struct sunqe *qep = netdev_priv(dev); |
686 | struct platform_device *op; | 686 | struct platform_device *op; |
687 | 687 | ||
688 | strcpy(info->driver, "sunqe"); | 688 | strlcpy(info->driver, "sunqe", sizeof(info->driver)); |
689 | strcpy(info->version, "3.0"); | 689 | strlcpy(info->version, "3.0", sizeof(info->version)); |
690 | 690 | ||
691 | op = qep->op; | 691 | op = qep->op; |
692 | regs = of_get_property(op->dev.of_node, "reg", NULL); | 692 | regs = of_get_property(op->dev.of_node, "reg", NULL); |
693 | if (regs) | 693 | if (regs) |
694 | sprintf(info->bus_info, "SBUS:%d", regs->which_io); | 694 | snprintf(info->bus_info, sizeof(info->bus_info), "SBUS:%d", |
695 | regs->which_io); | ||
695 | 696 | ||
696 | } | 697 | } |
697 | 698 | ||
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index e1b895530827..1cf767eb3ed5 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
@@ -882,8 +882,8 @@ static int vnet_set_mac_addr(struct net_device *dev, void *p) | |||
882 | static void vnet_get_drvinfo(struct net_device *dev, | 882 | static void vnet_get_drvinfo(struct net_device *dev, |
883 | struct ethtool_drvinfo *info) | 883 | struct ethtool_drvinfo *info) |
884 | { | 884 | { |
885 | strcpy(info->driver, DRV_MODULE_NAME); | 885 | strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver)); |
886 | strcpy(info->version, DRV_MODULE_VERSION); | 886 | strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version)); |
887 | } | 887 | } |
888 | 888 | ||
889 | static u32 vnet_get_msglevel(struct net_device *dev) | 889 | static u32 vnet_get_msglevel(struct net_device *dev) |
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index 1e4d743ff03e..e15cc71b826d 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c | |||
@@ -2179,10 +2179,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
2179 | { | 2179 | { |
2180 | struct bdx_priv *priv = netdev_priv(netdev); | 2180 | struct bdx_priv *priv = netdev_priv(netdev); |
2181 | 2181 | ||
2182 | strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); | 2182 | strlcpy(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); |
2183 | strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); | 2183 | strlcpy(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); |
2184 | strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | 2184 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
2185 | strlcat(drvinfo->bus_info, pci_name(priv->pdev), | 2185 | strlcpy(drvinfo->bus_info, pci_name(priv->pdev), |
2186 | sizeof(drvinfo->bus_info)); | 2186 | sizeof(drvinfo->bus_info)); |
2187 | 2187 | ||
2188 | drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0); | 2188 | drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0); |
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index d9625f62b026..70d1920cac97 100644 --- a/drivers/net/ethernet/ti/cpmac.c +++ b/drivers/net/ethernet/ti/cpmac.c | |||
@@ -904,10 +904,9 @@ static int cpmac_set_ringparam(struct net_device *dev, | |||
904 | static void cpmac_get_drvinfo(struct net_device *dev, | 904 | static void cpmac_get_drvinfo(struct net_device *dev, |
905 | struct ethtool_drvinfo *info) | 905 | struct ethtool_drvinfo *info) |
906 | { | 906 | { |
907 | strcpy(info->driver, "cpmac"); | 907 | strlcpy(info->driver, "cpmac", sizeof(info->driver)); |
908 | strcpy(info->version, CPMAC_VERSION); | 908 | strlcpy(info->version, CPMAC_VERSION, sizeof(info->version)); |
909 | info->fw_version[0] = '\0'; | 909 | snprintf(info->bus_info, sizeof(info->bus_info), "%s", "cpmac"); |
910 | sprintf(info->bus_info, "%s", "cpmac"); | ||
911 | info->regdump_len = 0; | 910 | info->regdump_len = 0; |
912 | } | 911 | } |
913 | 912 | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 40aff684aa23..bea736b8c3ec 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -944,9 +944,10 @@ static void cpsw_get_drvinfo(struct net_device *ndev, | |||
944 | struct ethtool_drvinfo *info) | 944 | struct ethtool_drvinfo *info) |
945 | { | 945 | { |
946 | struct cpsw_priv *priv = netdev_priv(ndev); | 946 | struct cpsw_priv *priv = netdev_priv(ndev); |
947 | strcpy(info->driver, "TI CPSW Driver v1.0"); | 947 | |
948 | strcpy(info->version, "1.0"); | 948 | strlcpy(info->driver, "TI CPSW Driver v1.0", sizeof(info->driver)); |
949 | strcpy(info->bus_info, priv->pdev->name); | 949 | strlcpy(info->version, "1.0", sizeof(info->version)); |
950 | strlcpy(info->bus_info, priv->pdev->name, sizeof(info->bus_info)); | ||
950 | } | 951 | } |
951 | 952 | ||
952 | static u32 cpsw_get_msglevel(struct net_device *ndev) | 953 | static u32 cpsw_get_msglevel(struct net_device *ndev) |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 6841a22c8621..6621ae3a98d9 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -480,8 +480,8 @@ static void emac_dump_regs(struct emac_priv *priv) | |||
480 | static void emac_get_drvinfo(struct net_device *ndev, | 480 | static void emac_get_drvinfo(struct net_device *ndev, |
481 | struct ethtool_drvinfo *info) | 481 | struct ethtool_drvinfo *info) |
482 | { | 482 | { |
483 | strcpy(info->driver, emac_version_string); | 483 | strlcpy(info->driver, emac_version_string, sizeof(info->driver)); |
484 | strcpy(info->version, EMAC_MODULE_VERSION); | 484 | strlcpy(info->version, EMAC_MODULE_VERSION, sizeof(info->version)); |
485 | } | 485 | } |
486 | 486 | ||
487 | /** | 487 | /** |
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index e321d0b6fc88..445c0595c997 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c | |||
@@ -1226,8 +1226,8 @@ int gelic_net_open(struct net_device *netdev) | |||
1226 | void gelic_net_get_drvinfo(struct net_device *netdev, | 1226 | void gelic_net_get_drvinfo(struct net_device *netdev, |
1227 | struct ethtool_drvinfo *info) | 1227 | struct ethtool_drvinfo *info) |
1228 | { | 1228 | { |
1229 | strncpy(info->driver, DRV_NAME, sizeof(info->driver) - 1); | 1229 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
1230 | strncpy(info->version, DRV_VERSION, sizeof(info->version) - 1); | 1230 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | static int gelic_ether_get_settings(struct net_device *netdev, | 1233 | static int gelic_ether_get_settings(struct net_device *netdev, |
diff --git a/drivers/net/ethernet/toshiba/spider_net_ethtool.c b/drivers/net/ethernet/toshiba/spider_net_ethtool.c index 9c288cd7d171..ffe519382e11 100644 --- a/drivers/net/ethernet/toshiba/spider_net_ethtool.c +++ b/drivers/net/ethernet/toshiba/spider_net_ethtool.c | |||
@@ -72,11 +72,13 @@ spider_net_ethtool_get_drvinfo(struct net_device *netdev, | |||
72 | card = netdev_priv(netdev); | 72 | card = netdev_priv(netdev); |
73 | 73 | ||
74 | /* clear and fill out info */ | 74 | /* clear and fill out info */ |
75 | memset(drvinfo, 0, sizeof(struct ethtool_drvinfo)); | 75 | strlcpy(drvinfo->driver, spider_net_driver_name, |
76 | strncpy(drvinfo->driver, spider_net_driver_name, 32); | 76 | sizeof(drvinfo->driver)); |
77 | strncpy(drvinfo->version, VERSION, 32); | 77 | strlcpy(drvinfo->version, VERSION, sizeof(drvinfo->version)); |
78 | strcpy(drvinfo->fw_version, "no information"); | 78 | strlcpy(drvinfo->fw_version, "no information", |
79 | strncpy(drvinfo->bus_info, pci_name(card->pdev), 32); | 79 | sizeof(drvinfo->fw_version)); |
80 | strlcpy(drvinfo->bus_info, pci_name(card->pdev), | ||
81 | sizeof(drvinfo->bus_info)); | ||
80 | } | 82 | } |
81 | 83 | ||
82 | static void | 84 | static void |
diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c index 9819349eaa1e..23a789e86de4 100644 --- a/drivers/net/ethernet/toshiba/tc35815.c +++ b/drivers/net/ethernet/toshiba/tc35815.c | |||
@@ -1976,9 +1976,10 @@ tc35815_set_multicast_list(struct net_device *dev) | |||
1976 | static void tc35815_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1976 | static void tc35815_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1977 | { | 1977 | { |
1978 | struct tc35815_local *lp = netdev_priv(dev); | 1978 | struct tc35815_local *lp = netdev_priv(dev); |
1979 | strcpy(info->driver, MODNAME); | 1979 | |
1980 | strcpy(info->version, DRV_VERSION); | 1980 | strlcpy(info->driver, MODNAME, sizeof(info->driver)); |
1981 | strcpy(info->bus_info, pci_name(lp->pci_dev)); | 1981 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
1982 | strlcpy(info->bus_info, pci_name(lp->pci_dev), sizeof(info->bus_info)); | ||
1982 | } | 1983 | } |
1983 | 1984 | ||
1984 | static int tc35815_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1985 | static int tc35815_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index d9f69b82cc4f..d3b3571b6013 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -1124,9 +1124,8 @@ static int axienet_ethtools_set_settings(struct net_device *ndev, | |||
1124 | static void axienet_ethtools_get_drvinfo(struct net_device *ndev, | 1124 | static void axienet_ethtools_get_drvinfo(struct net_device *ndev, |
1125 | struct ethtool_drvinfo *ed) | 1125 | struct ethtool_drvinfo *ed) |
1126 | { | 1126 | { |
1127 | memset(ed, 0, sizeof(struct ethtool_drvinfo)); | 1127 | strlcpy(ed->driver, DRIVER_NAME, sizeof(ed->driver)); |
1128 | strcpy(ed->driver, DRIVER_NAME); | 1128 | strlcpy(ed->version, DRIVER_VERSION, sizeof(ed->version)); |
1129 | strcpy(ed->version, DRIVER_VERSION); | ||
1130 | ed->regdump_len = sizeof(u32) * AXIENET_REGS_N; | 1129 | ed->regdump_len = sizeof(u32) * AXIENET_REGS_N; |
1131 | } | 1130 | } |
1132 | 1131 | ||
diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c index 94a1f94f74b8..98e09d0d3ce2 100644 --- a/drivers/net/ethernet/xircom/xirc2ps_cs.c +++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c | |||
@@ -1412,7 +1412,8 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
1412 | struct ethtool_drvinfo *info) | 1412 | struct ethtool_drvinfo *info) |
1413 | { | 1413 | { |
1414 | strlcpy(info->driver, "xirc2ps_cs", sizeof(info->driver)); | 1414 | strlcpy(info->driver, "xirc2ps_cs", sizeof(info->driver)); |
1415 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 1415 | snprintf(info->bus_info, sizeof(info->bus_info), "PCMCIA 0x%lx", |
1416 | dev->base_addr); | ||
1416 | } | 1417 | } |
1417 | 1418 | ||
1418 | static const struct ethtool_ops netdev_ethtool_ops = { | 1419 | static const struct ethtool_ops netdev_ethtool_ops = { |
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index d3ebb73277be..a4be1ad886c5 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c | |||
@@ -977,11 +977,12 @@ static void ixp4xx_get_drvinfo(struct net_device *dev, | |||
977 | struct ethtool_drvinfo *info) | 977 | struct ethtool_drvinfo *info) |
978 | { | 978 | { |
979 | struct port *port = netdev_priv(dev); | 979 | struct port *port = netdev_priv(dev); |
980 | strcpy(info->driver, DRV_NAME); | 980 | |
981 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | ||
981 | snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u", | 982 | snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u", |
982 | port->firmware[0], port->firmware[1], | 983 | port->firmware[0], port->firmware[1], |
983 | port->firmware[2], port->firmware[3]); | 984 | port->firmware[2], port->firmware[3]); |
984 | strcpy(info->bus_info, "internal"); | 985 | strlcpy(info->bus_info, "internal", sizeof(info->bus_info)); |
985 | } | 986 | } |
986 | 987 | ||
987 | static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 988 | static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index f825a629a699..a9975c7e6461 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -304,9 +304,9 @@ int netvsc_recv_callback(struct hv_device *device_obj, | |||
304 | static void netvsc_get_drvinfo(struct net_device *net, | 304 | static void netvsc_get_drvinfo(struct net_device *net, |
305 | struct ethtool_drvinfo *info) | 305 | struct ethtool_drvinfo *info) |
306 | { | 306 | { |
307 | strcpy(info->driver, KBUILD_MODNAME); | 307 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
308 | strcpy(info->version, HV_DRV_VERSION); | 308 | strlcpy(info->version, HV_DRV_VERSION, sizeof(info->version)); |
309 | strcpy(info->fw_version, "N/A"); | 309 | strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
310 | } | 310 | } |
311 | 311 | ||
312 | static int netvsc_change_mtu(struct net_device *ndev, int mtu) | 312 | static int netvsc_change_mtu(struct net_device *ndev, int mtu) |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 0ae45182f40d..1047e5875801 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -585,8 +585,8 @@ static int macvlan_fdb_del(struct ndmsg *ndm, | |||
585 | static void macvlan_ethtool_get_drvinfo(struct net_device *dev, | 585 | static void macvlan_ethtool_get_drvinfo(struct net_device *dev, |
586 | struct ethtool_drvinfo *drvinfo) | 586 | struct ethtool_drvinfo *drvinfo) |
587 | { | 587 | { |
588 | snprintf(drvinfo->driver, 32, "macvlan"); | 588 | strlcpy(drvinfo->driver, "macvlan", sizeof(drvinfo->driver)); |
589 | snprintf(drvinfo->version, 32, "0.1"); | 589 | strlcpy(drvinfo->version, "0.1", sizeof(drvinfo->version)); |
590 | } | 590 | } |
591 | 591 | ||
592 | static int macvlan_ethtool_get_settings(struct net_device *dev, | 592 | static int macvlan_ethtool_get_settings(struct net_device *dev, |
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index d8b9b1e8ee02..f433b594388e 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -410,10 +410,10 @@ static void rionet_get_drvinfo(struct net_device *ndev, | |||
410 | { | 410 | { |
411 | struct rionet_private *rnet = netdev_priv(ndev); | 411 | struct rionet_private *rnet = netdev_priv(ndev); |
412 | 412 | ||
413 | strcpy(info->driver, DRV_NAME); | 413 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
414 | strcpy(info->version, DRV_VERSION); | 414 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
415 | strcpy(info->fw_version, "n/a"); | 415 | strlcpy(info->fw_version, "n/a", sizeof(info->fw_version)); |
416 | strcpy(info->bus_info, rnet->mport->name); | 416 | strlcpy(info->bus_info, rnet->mport->name, sizeof(info->bus_info)); |
417 | } | 417 | } |
418 | 418 | ||
419 | static u32 rionet_get_msglevel(struct net_device *ndev) | 419 | static u32 rionet_get_msglevel(struct net_device *ndev) |
diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c index 50d167330d38..19bc23f20526 100644 --- a/drivers/net/usb/asix_common.c +++ b/drivers/net/usb/asix_common.c | |||
@@ -510,8 +510,8 @@ void asix_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) | |||
510 | { | 510 | { |
511 | /* Inherit standard device info */ | 511 | /* Inherit standard device info */ |
512 | usbnet_get_drvinfo(net, info); | 512 | usbnet_get_drvinfo(net, info); |
513 | strncpy (info->driver, DRIVER_NAME, sizeof info->driver); | 513 | strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); |
514 | strncpy (info->version, DRIVER_VERSION, sizeof info->version); | 514 | strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); |
515 | info->eedump_len = AX_EEPROM_LEN; | 515 | info->eedump_len = AX_EEPROM_LEN; |
516 | } | 516 | } |
517 | 517 | ||
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index 18d9579123ea..8d5cac2d8e33 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -685,9 +685,9 @@ static void catc_get_drvinfo(struct net_device *dev, | |||
685 | struct ethtool_drvinfo *info) | 685 | struct ethtool_drvinfo *info) |
686 | { | 686 | { |
687 | struct catc *catc = netdev_priv(dev); | 687 | struct catc *catc = netdev_priv(dev); |
688 | strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN); | 688 | strlcpy(info->driver, driver_name, sizeof(info->driver)); |
689 | strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); | 689 | strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); |
690 | usb_make_path (catc->usbdev, info->bus_info, sizeof info->bus_info); | 690 | usb_make_path(catc->usbdev, info->bus_info, sizeof(info->bus_info)); |
691 | } | 691 | } |
692 | 692 | ||
693 | static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 693 | static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 71b6e92b8e9b..016aa6fe6acb 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -65,9 +65,9 @@ cdc_ncm_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) | |||
65 | { | 65 | { |
66 | struct usbnet *dev = netdev_priv(net); | 66 | struct usbnet *dev = netdev_priv(net); |
67 | 67 | ||
68 | strncpy(info->driver, dev->driver_name, sizeof(info->driver)); | 68 | strlcpy(info->driver, dev->driver_name, sizeof(info->driver)); |
69 | strncpy(info->version, DRIVER_VERSION, sizeof(info->version)); | 69 | strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); |
70 | strncpy(info->fw_version, dev->driver_info->description, | 70 | strlcpy(info->fw_version, dev->driver_info->description, |
71 | sizeof(info->fw_version)); | 71 | sizeof(info->fw_version)); |
72 | usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); | 72 | usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); |
73 | } | 73 | } |
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index a0b5807b30d4..3c02f950a3d2 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -1074,8 +1074,9 @@ static void pegasus_get_drvinfo(struct net_device *dev, | |||
1074 | struct ethtool_drvinfo *info) | 1074 | struct ethtool_drvinfo *info) |
1075 | { | 1075 | { |
1076 | pegasus_t *pegasus = netdev_priv(dev); | 1076 | pegasus_t *pegasus = netdev_priv(dev); |
1077 | strncpy(info->driver, driver_name, sizeof(info->driver) - 1); | 1077 | |
1078 | strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1); | 1078 | strlcpy(info->driver, driver_name, sizeof(info->driver)); |
1079 | strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); | ||
1079 | usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info)); | 1080 | usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info)); |
1080 | } | 1081 | } |
1081 | 1082 | ||
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 5f39a3b225ef..a491d3a95393 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -776,9 +776,9 @@ static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinf | |||
776 | { | 776 | { |
777 | rtl8150_t *dev = netdev_priv(netdev); | 777 | rtl8150_t *dev = netdev_priv(netdev); |
778 | 778 | ||
779 | strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN); | 779 | strlcpy(info->driver, driver_name, sizeof(info->driver)); |
780 | strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); | 780 | strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); |
781 | usb_make_path(dev->udev, info->bus_info, sizeof info->bus_info); | 781 | usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); |
782 | } | 782 | } |
783 | 783 | ||
784 | static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 784 | static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c index 18dd4257ab17..453aa6c1277c 100644 --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c | |||
@@ -598,8 +598,8 @@ static void sierra_net_get_drvinfo(struct net_device *net, | |||
598 | { | 598 | { |
599 | /* Inherit standard device info */ | 599 | /* Inherit standard device info */ |
600 | usbnet_get_drvinfo(net, info); | 600 | usbnet_get_drvinfo(net, info); |
601 | strncpy(info->driver, driver_name, sizeof info->driver); | 601 | strlcpy(info->driver, driver_name, sizeof(info->driver)); |
602 | strncpy(info->version, DRIVER_VERSION, sizeof info->version); | 602 | strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); |
603 | } | 603 | } |
604 | 604 | ||
605 | static u32 sierra_net_get_link(struct net_device *net) | 605 | static u32 sierra_net_get_link(struct net_device *net) |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 587a218b2345..8c9fa4b41d78 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
@@ -207,7 +207,7 @@ vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
207 | sizeof(drvinfo->version)); | 207 | sizeof(drvinfo->version)); |
208 | 208 | ||
209 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), | 209 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
210 | ETHTOOL_BUSINFO_LEN); | 210 | sizeof(drvinfo->bus_info)); |
211 | drvinfo->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS); | 211 | drvinfo->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS); |
212 | drvinfo->testinfo_len = 0; | 212 | drvinfo->testinfo_len = 0; |
213 | drvinfo->eedump_len = 0; | 213 | drvinfo->eedump_len = 0; |
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c index 1d76ae855f07..cedd4d30d996 100644 --- a/drivers/net/wimax/i2400m/netdev.c +++ b/drivers/net/wimax/i2400m/netdev.c | |||
@@ -596,12 +596,12 @@ static void i2400m_get_drvinfo(struct net_device *net_dev, | |||
596 | { | 596 | { |
597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); | 597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); |
598 | 598 | ||
599 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | 599 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
600 | strncpy(info->fw_version, | 600 | strlcpy(info->fw_version, i2400m->fw_name ? : "", |
601 | i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | 601 | sizeof(info->fw_version)); |
602 | if (net_dev->dev.parent) | 602 | if (net_dev->dev.parent) |
603 | strncpy(info->bus_info, dev_name(net_dev->dev.parent), | 603 | strlcpy(info->bus_info, dev_name(net_dev->dev.parent), |
604 | sizeof(info->bus_info) - 1); | 604 | sizeof(info->bus_info)); |
605 | } | 605 | } |
606 | 606 | ||
607 | static const struct ethtool_ops i2400m_ethtool_ops = { | 607 | static const struct ethtool_ops i2400m_ethtool_ops = { |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index 080f36303a4f..cd15a93d9084 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -346,9 +346,9 @@ static void i2400mu_get_drvinfo(struct net_device *net_dev, | |||
346 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); | 346 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); |
347 | struct usb_device *udev = i2400mu->usb_dev; | 347 | struct usb_device *udev = i2400mu->usb_dev; |
348 | 348 | ||
349 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | 349 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
350 | strncpy(info->fw_version, | 350 | strlcpy(info->fw_version, i2400m->fw_name ? : "", |
351 | i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | 351 | sizeof(info->fw_version)); |
352 | usb_make_path(udev, info->bus_info, sizeof(info->bus_info)); | 352 | usb_make_path(udev, info->bus_info, sizeof(info->bus_info)); |
353 | } | 353 | } |
354 | 354 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 74a616b4de8e..8c28a1518409 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -395,9 +395,11 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev, | |||
395 | struct brcmf_if *ifp = netdev_priv(ndev); | 395 | struct brcmf_if *ifp = netdev_priv(ndev); |
396 | struct brcmf_pub *drvr = ifp->drvr; | 396 | struct brcmf_pub *drvr = ifp->drvr; |
397 | 397 | ||
398 | sprintf(info->driver, KBUILD_MODNAME); | 398 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); |
399 | sprintf(info->version, "%lu", drvr->drv_version); | 399 | snprintf(info->version, sizeof(info->version), "%lu", |
400 | sprintf(info->bus_info, "%s", dev_name(drvr->bus_if->dev)); | 400 | drvr->drv_version); |
401 | strlcpy(info->bus_info, dev_name(drvr->bus_if->dev), | ||
402 | sizeof(info->bus_info)); | ||
401 | } | 403 | } |
402 | 404 | ||
403 | static const struct ethtool_ops brcmf_ethtool_ops = { | 405 | static const struct ethtool_ops brcmf_ethtool_ops = { |