aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c8
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_ethtool.c13
-rw-r--r--drivers/net/ethernet/intel/e1000e/ethtool.c16
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c15
-rw-r--r--drivers/net/ethernet/intel/igbvf/ethtool.c12
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c11
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c11
-rw-r--r--drivers/net/ethernet/sun/cassini.c7
9 files changed, 54 insertions, 55 deletions
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index c3786fda11db..1fe5df0284a6 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -217,11 +217,11 @@ static void enic_get_drvinfo(struct net_device *netdev,
217 217
218 enic_dev_fw_info(enic, &fw_info); 218 enic_dev_fw_info(enic, &fw_info);
219 219
220 strncpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); 220 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
221 strncpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version)); 221 strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
222 strncpy(drvinfo->fw_version, fw_info->fw_version, 222 strlcpy(drvinfo->fw_version, fw_info->fw_version,
223 sizeof(drvinfo->fw_version)); 223 sizeof(drvinfo->fw_version));
224 strncpy(drvinfo->bus_info, pci_name(enic->pdev), 224 strlcpy(drvinfo->bus_info, pci_name(enic->pdev),
225 sizeof(drvinfo->bus_info)); 225 sizeof(drvinfo->bus_info));
226} 226}
227 227
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 2b223ac99c42..63faec693deb 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -515,14 +515,15 @@ static void e1000_get_drvinfo(struct net_device *netdev,
515 struct ethtool_drvinfo *drvinfo) 515 struct ethtool_drvinfo *drvinfo)
516{ 516{
517 struct e1000_adapter *adapter = netdev_priv(netdev); 517 struct e1000_adapter *adapter = netdev_priv(netdev);
518 char firmware_version[32];
519 518
520 strncpy(drvinfo->driver, e1000_driver_name, 32); 519 strlcpy(drvinfo->driver, e1000_driver_name,
521 strncpy(drvinfo->version, e1000_driver_version, 32); 520 sizeof(drvinfo->driver));
521 strlcpy(drvinfo->version, e1000_driver_version,
522 sizeof(drvinfo->version));
522 523
523 sprintf(firmware_version, "N/A"); 524 strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
524 strncpy(drvinfo->fw_version, firmware_version, 32); 525 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
525 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 526 sizeof(drvinfo->bus_info));
526 drvinfo->regdump_len = e1000_get_regs_len(netdev); 527 drvinfo->regdump_len = e1000_get_regs_len(netdev);
527 drvinfo->eedump_len = e1000_get_eeprom_len(netdev); 528 drvinfo->eedump_len = e1000_get_eeprom_len(netdev);
528} 529}
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index 69c9d2199140..6d8f0ed33214 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -579,26 +579,24 @@ static void e1000_get_drvinfo(struct net_device *netdev,
579 struct ethtool_drvinfo *drvinfo) 579 struct ethtool_drvinfo *drvinfo)
580{ 580{
581 struct e1000_adapter *adapter = netdev_priv(netdev); 581 struct e1000_adapter *adapter = netdev_priv(netdev);
582 char firmware_version[32];
583 582
584 strncpy(drvinfo->driver, e1000e_driver_name, 583 strlcpy(drvinfo->driver, e1000e_driver_name,
585 sizeof(drvinfo->driver) - 1); 584 sizeof(drvinfo->driver));
586 strncpy(drvinfo->version, e1000e_driver_version, 585 strncpy(drvinfo->version, e1000e_driver_version,
587 sizeof(drvinfo->version) - 1); 586 sizeof(drvinfo->version));
588 587
589 /* 588 /*
590 * EEPROM image version # is reported as firmware version # for 589 * EEPROM image version # is reported as firmware version # for
591 * PCI-E controllers 590 * PCI-E controllers
592 */ 591 */
593 snprintf(firmware_version, sizeof(firmware_version), "%d.%d-%d", 592 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
593 "%d.%d-%d",
594 (adapter->eeprom_vers & 0xF000) >> 12, 594 (adapter->eeprom_vers & 0xF000) >> 12,
595 (adapter->eeprom_vers & 0x0FF0) >> 4, 595 (adapter->eeprom_vers & 0x0FF0) >> 4,
596 (adapter->eeprom_vers & 0x000F)); 596 (adapter->eeprom_vers & 0x000F));
597 597
598 strncpy(drvinfo->fw_version, firmware_version, 598 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
599 sizeof(drvinfo->fw_version) - 1); 599 sizeof(drvinfo->bus_info));
600 strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
601 sizeof(drvinfo->bus_info) - 1);
602 drvinfo->regdump_len = e1000_get_regs_len(netdev); 600 drvinfo->regdump_len = e1000_get_regs_len(netdev);
603 drvinfo->eedump_len = e1000_get_eeprom_len(netdev); 601 drvinfo->eedump_len = e1000_get_eeprom_len(netdev);
604} 602}
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 43873eba2f63..e9335efac386 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -673,25 +673,22 @@ static void igb_get_drvinfo(struct net_device *netdev,
673 struct ethtool_drvinfo *drvinfo) 673 struct ethtool_drvinfo *drvinfo)
674{ 674{
675 struct igb_adapter *adapter = netdev_priv(netdev); 675 struct igb_adapter *adapter = netdev_priv(netdev);
676 char firmware_version[32];
677 u16 eeprom_data; 676 u16 eeprom_data;
678 677
679 strncpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver) - 1); 678 strlcpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver));
680 strncpy(drvinfo->version, igb_driver_version, 679 strlcpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version));
681 sizeof(drvinfo->version) - 1);
682 680
683 /* EEPROM image version # is reported as firmware version # for 681 /* EEPROM image version # is reported as firmware version # for
684 * 82575 controllers */ 682 * 82575 controllers */
685 adapter->hw.nvm.ops.read(&adapter->hw, 5, 1, &eeprom_data); 683 adapter->hw.nvm.ops.read(&adapter->hw, 5, 1, &eeprom_data);
686 sprintf(firmware_version, "%d.%d-%d", 684 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
685 "%d.%d-%d",
687 (eeprom_data & 0xF000) >> 12, 686 (eeprom_data & 0xF000) >> 12,
688 (eeprom_data & 0x0FF0) >> 4, 687 (eeprom_data & 0x0FF0) >> 4,
689 eeprom_data & 0x000F); 688 eeprom_data & 0x000F);
690 689
691 strncpy(drvinfo->fw_version, firmware_version, 690 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
692 sizeof(drvinfo->fw_version) - 1); 691 sizeof(drvinfo->bus_info));
693 strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
694 sizeof(drvinfo->bus_info) - 1);
695 drvinfo->n_stats = IGB_STATS_LEN; 692 drvinfo->n_stats = IGB_STATS_LEN;
696 drvinfo->testinfo_len = IGB_TEST_LEN; 693 drvinfo->testinfo_len = IGB_TEST_LEN;
697 drvinfo->regdump_len = igb_get_regs_len(netdev); 694 drvinfo->regdump_len = igb_get_regs_len(netdev);
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c
index 2c25858cc0ff..e60f1c6957af 100644
--- a/drivers/net/ethernet/intel/igbvf/ethtool.c
+++ b/drivers/net/ethernet/intel/igbvf/ethtool.c
@@ -191,12 +191,14 @@ static void igbvf_get_drvinfo(struct net_device *netdev,
191 struct ethtool_drvinfo *drvinfo) 191 struct ethtool_drvinfo *drvinfo)
192{ 192{
193 struct igbvf_adapter *adapter = netdev_priv(netdev); 193 struct igbvf_adapter *adapter = netdev_priv(netdev);
194 char firmware_version[32] = "N/A";
195 194
196 strncpy(drvinfo->driver, igbvf_driver_name, 32); 195 strlcpy(drvinfo->driver, igbvf_driver_name, sizeof(drvinfo->driver));
197 strncpy(drvinfo->version, igbvf_driver_version, 32); 196 strlcpy(drvinfo->version, igbvf_driver_version,
198 strncpy(drvinfo->fw_version, firmware_version, 32); 197 sizeof(drvinfo->version));
199 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 198 strlcpy(drvinfo->fw_version, "N/A",
199 sizeof(drvinfo->fw_version));
200 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
201 sizeof(drvinfo->bus_info));
200 drvinfo->regdump_len = igbvf_get_regs_len(netdev); 202 drvinfo->regdump_len = igbvf_get_regs_len(netdev);
201 drvinfo->eedump_len = igbvf_get_eeprom_len(netdev); 203 drvinfo->eedump_len = igbvf_get_eeprom_len(netdev);
202} 204}
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c b/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c
index 9dfce7dff79b..96fcb0e06450 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c
@@ -473,10 +473,13 @@ ixgb_get_drvinfo(struct net_device *netdev,
473{ 473{
474 struct ixgb_adapter *adapter = netdev_priv(netdev); 474 struct ixgb_adapter *adapter = netdev_priv(netdev);
475 475
476 strncpy(drvinfo->driver, ixgb_driver_name, 32); 476 strlcpy(drvinfo->driver, ixgb_driver_name,
477 strncpy(drvinfo->version, ixgb_driver_version, 32); 477 sizeof(drvinfo->driver));
478 strncpy(drvinfo->fw_version, "N/A", 32); 478 strlcpy(drvinfo->version, ixgb_driver_version,
479 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 479 sizeof(drvinfo->version));
480 strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
481 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
482 sizeof(drvinfo->bus_info));
480 drvinfo->n_stats = IXGB_STATS_LEN; 483 drvinfo->n_stats = IXGB_STATS_LEN;
481 drvinfo->regdump_len = ixgb_get_regs_len(netdev); 484 drvinfo->regdump_len = ixgb_get_regs_len(netdev);
482 drvinfo->eedump_len = ixgb_get_eeprom_len(netdev); 485 drvinfo->eedump_len = ixgb_get_eeprom_len(netdev);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 70d58c3849b0..91f871b6b3ba 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -888,23 +888,19 @@ static void ixgbe_get_drvinfo(struct net_device *netdev,
888 struct ethtool_drvinfo *drvinfo) 888 struct ethtool_drvinfo *drvinfo)
889{ 889{
890 struct ixgbe_adapter *adapter = netdev_priv(netdev); 890 struct ixgbe_adapter *adapter = netdev_priv(netdev);
891 char firmware_version[32];
892 u32 nvm_track_id; 891 u32 nvm_track_id;
893 892
894 strncpy(drvinfo->driver, ixgbe_driver_name, 893 strlcpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver));
895 sizeof(drvinfo->driver) - 1); 894 strlcpy(drvinfo->version, ixgbe_driver_version,
896 strncpy(drvinfo->version, ixgbe_driver_version, 895 sizeof(drvinfo->version));
897 sizeof(drvinfo->version) - 1);
898 896
899 nvm_track_id = (adapter->eeprom_verh << 16) | 897 nvm_track_id = (adapter->eeprom_verh << 16) |
900 adapter->eeprom_verl; 898 adapter->eeprom_verl;
901 snprintf(firmware_version, sizeof(firmware_version), "0x%08x", 899 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "0x%08x",
902 nvm_track_id); 900 nvm_track_id);
903 901
904 strncpy(drvinfo->fw_version, firmware_version, 902 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
905 sizeof(drvinfo->fw_version) - 1); 903 sizeof(drvinfo->bus_info));
906 strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
907 sizeof(drvinfo->bus_info) - 1);
908 drvinfo->n_stats = IXGBE_STATS_LEN; 904 drvinfo->n_stats = IXGBE_STATS_LEN;
909 drvinfo->testinfo_len = IXGBE_TEST_LEN; 905 drvinfo->testinfo_len = IXGBE_TEST_LEN;
910 drvinfo->regdump_len = ixgbe_get_regs_len(netdev); 906 drvinfo->regdump_len = ixgbe_get_regs_len(netdev);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index 74e2a2a8a02b..ee637a200915 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -45,13 +45,16 @@ mlx4_en_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
45 struct mlx4_en_priv *priv = netdev_priv(dev); 45 struct mlx4_en_priv *priv = netdev_priv(dev);
46 struct mlx4_en_dev *mdev = priv->mdev; 46 struct mlx4_en_dev *mdev = priv->mdev;
47 47
48 strncpy(drvinfo->driver, DRV_NAME, 32); 48 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
49 strncpy(drvinfo->version, DRV_VERSION " (" DRV_RELDATE ")", 32); 49 strlcpy(drvinfo->version, DRV_VERSION " (" DRV_RELDATE ")",
50 sprintf(drvinfo->fw_version, "%d.%d.%d", 50 sizeof(drvinfo->version));
51 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
52 "%d.%d.%d",
51 (u16) (mdev->dev->caps.fw_ver >> 32), 53 (u16) (mdev->dev->caps.fw_ver >> 32),
52 (u16) ((mdev->dev->caps.fw_ver >> 16) & 0xffff), 54 (u16) ((mdev->dev->caps.fw_ver >> 16) & 0xffff),
53 (u16) (mdev->dev->caps.fw_ver & 0xffff)); 55 (u16) (mdev->dev->caps.fw_ver & 0xffff));
54 strncpy(drvinfo->bus_info, pci_name(mdev->dev->pdev), 32); 56 strlcpy(drvinfo->bus_info, pci_name(mdev->dev->pdev),
57 sizeof(drvinfo->bus_info));
55 drvinfo->n_stats = 0; 58 drvinfo->n_stats = 0;
56 drvinfo->regdump_len = 0; 59 drvinfo->regdump_len = 0;
57 drvinfo->eedump_len = 0; 60 drvinfo->eedump_len = 0;
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
index fd40988c19a6..f10665f594c4 100644
--- a/drivers/net/ethernet/sun/cassini.c
+++ b/drivers/net/ethernet/sun/cassini.c
@@ -4532,10 +4532,9 @@ static void cas_set_multicast(struct net_device *dev)
4532static void cas_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 4532static void cas_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
4533{ 4533{
4534 struct cas *cp = netdev_priv(dev); 4534 struct cas *cp = netdev_priv(dev);
4535 strncpy(info->driver, DRV_MODULE_NAME, ETHTOOL_BUSINFO_LEN); 4535 strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
4536 strncpy(info->version, DRV_MODULE_VERSION, ETHTOOL_BUSINFO_LEN); 4536 strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
4537 info->fw_version[0] = '\0'; 4537 strlcpy(info->bus_info, pci_name(cp->pdev), sizeof(info->bus_info));
4538 strncpy(info->bus_info, pci_name(cp->pdev), ETHTOOL_BUSINFO_LEN);
4539 info->regdump_len = cp->casreg_len < CAS_MAX_REGS ? 4538 info->regdump_len = cp->casreg_len < CAS_MAX_REGS ?
4540 cp->casreg_len : CAS_MAX_REGS; 4539 cp->casreg_len : CAS_MAX_REGS;
4541 info->n_stats = CAS_NUM_STAT_KEYS; 4540 info->n_stats = CAS_NUM_STAT_KEYS;