aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic
diff options
context:
space:
mode:
authorRick Jones <rick.jones2@hp.com>2011-11-07 08:29:27 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-08 15:11:57 -0500
commit68aad78c5023b8aa82da99b47f9d8cf40e8ca453 (patch)
treec9f90903bd2e7831ea6fc5231affa3b9fc908b73 /drivers/net/ethernet/qlogic
parent34d2d89f2d7da3b72b3157e778bbf709047ded97 (diff)
sweep the floors and convert some .get_drvinfo routines to strlcpy
Per the mention made by Ben Hutchings that strlcpy is now the preferred string copy routine for a .get_drvinfo routine, do a bit of floor sweeping and convert some of the as-yet unconverted ethernet drivers to it. Signed-off-by: Rick Jones <rick.jones2@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic')
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c12
-rw-r--r--drivers/net/ethernet/qlogic/qla3xxx.c10
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c13
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c11
4 files changed, 29 insertions, 17 deletions
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
index e09ea83b8c4..8a371985319 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
@@ -83,14 +83,18 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
83 u32 fw_minor = 0; 83 u32 fw_minor = 0;
84 u32 fw_build = 0; 84 u32 fw_build = 0;
85 85
86 strncpy(drvinfo->driver, netxen_nic_driver_name, 32); 86 strlcpy(drvinfo->driver, netxen_nic_driver_name,
87 strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); 87 sizeof(drvinfo->driver));
88 strlcpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID,
89 sizeof(drvinfo->version));
88 fw_major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); 90 fw_major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR);
89 fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); 91 fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR);
90 fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); 92 fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB);
91 sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); 93 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
94 "%d.%d.%d", fw_major, fw_minor, fw_build);
92 95
93 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 96 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
97 sizeof(drvinfo->bus_info));
94 drvinfo->regdump_len = NETXEN_NIC_REGS_LEN; 98 drvinfo->regdump_len = NETXEN_NIC_REGS_LEN;
95 drvinfo->eedump_len = netxen_nic_get_eeprom_len(dev); 99 drvinfo->eedump_len = netxen_nic_get_eeprom_len(dev);
96} 100}
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index a4bdff438a5..9416f297100 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -1735,10 +1735,12 @@ static void ql_get_drvinfo(struct net_device *ndev,
1735 struct ethtool_drvinfo *drvinfo) 1735 struct ethtool_drvinfo *drvinfo)
1736{ 1736{
1737 struct ql3_adapter *qdev = netdev_priv(ndev); 1737 struct ql3_adapter *qdev = netdev_priv(ndev);
1738 strncpy(drvinfo->driver, ql3xxx_driver_name, 32); 1738 strlcpy(drvinfo->driver, ql3xxx_driver_name, sizeof(drvinfo->driver));
1739 strncpy(drvinfo->version, ql3xxx_driver_version, 32); 1739 strlcpy(drvinfo->version, ql3xxx_driver_version,
1740 strncpy(drvinfo->fw_version, "N/A", 32); 1740 sizeof(drvinfo->version));
1741 strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); 1741 strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
1742 strlcpy(drvinfo->bus_info, pci_name(qdev->pdev),
1743 sizeof(drvinfo->bus_info));
1742 drvinfo->regdump_len = 0; 1744 drvinfo->regdump_len = 0;
1743 drvinfo->eedump_len = 0; 1745 drvinfo->eedump_len = 0;
1744} 1746}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 8aa1c6e8667..cc228cf3d84 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -140,11 +140,14 @@ qlcnic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
140 fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR); 140 fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR);
141 fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR); 141 fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR);
142 fw_build = QLCRD32(adapter, QLCNIC_FW_VERSION_SUB); 142 fw_build = QLCRD32(adapter, QLCNIC_FW_VERSION_SUB);
143 sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); 143 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
144 144 "%d.%d.%d", fw_major, fw_minor, fw_build);
145 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 145
146 strlcpy(drvinfo->driver, qlcnic_driver_name, 32); 146 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
147 strlcpy(drvinfo->version, QLCNIC_LINUX_VERSIONID, 32); 147 sizeof(drvinfo->bus_info));
148 strlcpy(drvinfo->driver, qlcnic_driver_name, sizeof(drvinfo->driver));
149 strlcpy(drvinfo->version, QLCNIC_LINUX_VERSIONID,
150 sizeof(drvinfo->version));
148} 151}
149 152
150static int 153static int
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
index 9b67bfea035..8e2c2a74f3a 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
@@ -366,13 +366,16 @@ static void ql_get_drvinfo(struct net_device *ndev,
366 struct ethtool_drvinfo *drvinfo) 366 struct ethtool_drvinfo *drvinfo)
367{ 367{
368 struct ql_adapter *qdev = netdev_priv(ndev); 368 struct ql_adapter *qdev = netdev_priv(ndev);
369 strncpy(drvinfo->driver, qlge_driver_name, 32); 369 strlcpy(drvinfo->driver, qlge_driver_name, sizeof(drvinfo->driver));
370 strncpy(drvinfo->version, qlge_driver_version, 32); 370 strlcpy(drvinfo->version, qlge_driver_version,
371 snprintf(drvinfo->fw_version, 32, "v%d.%d.%d", 371 sizeof(drvinfo->version));
372 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
373 "v%d.%d.%d",
372 (qdev->fw_rev_id & 0x00ff0000) >> 16, 374 (qdev->fw_rev_id & 0x00ff0000) >> 16,
373 (qdev->fw_rev_id & 0x0000ff00) >> 8, 375 (qdev->fw_rev_id & 0x0000ff00) >> 8,
374 (qdev->fw_rev_id & 0x000000ff)); 376 (qdev->fw_rev_id & 0x000000ff));
375 strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); 377 strlcpy(drvinfo->bus_info, pci_name(qdev->pdev),
378 sizeof(drvinfo->bus_info));
376 drvinfo->n_stats = 0; 379 drvinfo->n_stats = 0;
377 drvinfo->testinfo_len = 0; 380 drvinfo->testinfo_len = 0;
378 if (!test_bit(QL_FRC_COREDUMP, &qdev->flags)) 381 if (!test_bit(QL_FRC_COREDUMP, &qdev->flags))