From 612a94d6f24eb2427eabf554392080302da664dd Mon Sep 17 00:00:00 2001 From: Rick Jones Date: Mon, 14 Nov 2011 08:13:25 +0000 Subject: 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 Signed-off-by: David S. Miller --- drivers/net/ethernet/intel/e1000e/ethtool.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'drivers/net/ethernet/intel/e1000e/ethtool.c') 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, struct ethtool_drvinfo *drvinfo) { struct e1000_adapter *adapter = netdev_priv(netdev); - char firmware_version[32]; - strncpy(drvinfo->driver, e1000e_driver_name, - sizeof(drvinfo->driver) - 1); + strlcpy(drvinfo->driver, e1000e_driver_name, + sizeof(drvinfo->driver)); strncpy(drvinfo->version, e1000e_driver_version, - sizeof(drvinfo->version) - 1); + sizeof(drvinfo->version)); /* * EEPROM image version # is reported as firmware version # for * PCI-E controllers */ - snprintf(firmware_version, sizeof(firmware_version), "%d.%d-%d", + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), + "%d.%d-%d", (adapter->eeprom_vers & 0xF000) >> 12, (adapter->eeprom_vers & 0x0FF0) >> 4, (adapter->eeprom_vers & 0x000F)); - strncpy(drvinfo->fw_version, firmware_version, - sizeof(drvinfo->fw_version) - 1); - strncpy(drvinfo->bus_info, pci_name(adapter->pdev), - sizeof(drvinfo->bus_info) - 1); + strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), + sizeof(drvinfo->bus_info)); drvinfo->regdump_len = e1000_get_regs_len(netdev); drvinfo->eedump_len = e1000_get_eeprom_len(netdev); } -- cgit v1.2.2