aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorRick Jones <rick.jones2@hp.com>2011-11-14 03:13:25 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-14 14:13:31 -0500
commit612a94d6f24eb2427eabf554392080302da664dd (patch)
tree00202ffa2c3a59b6f3e59e906e7b6a14375f88b6 /drivers/net/ethernet/intel
parente52fcb2462ac484e6dd6e68869536609f0216938 (diff)
Sweep the last of the active .get_drvinfo floors under ethernet/
This round of floor sweeping converts strncpy calls in various .get_drvinfo routines to the preferred strlcpy. It also does a modicum of other cleaning in those routines. Signed-off-by: Rick Jones <rick.jones2@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel')
-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
6 files changed, 40 insertions, 43 deletions
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);