aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Rustad <mark.d.rustad@intel.com>2014-06-06 01:57:06 +0000
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-07-24 02:16:32 -0700
commit339de30f5b40b08574a8ca53670d795f7dd1f8bb (patch)
treebb683194e031f5ee208b7a8f47d5cd5eb9f2bd78 /drivers
parentixgbe: Fix possible null-dereference in error path (diff)
downloadlinux-dev-339de30f5b40b08574a8ca53670d795f7dd1f8bb.tar.xz
linux-dev-339de30f5b40b08574a8ca53670d795f7dd1f8bb.zip
ixgbe: Change some uses of strncpy to strlcpy
Change some uses of strncpy to use the more appropriate strlcpy when clearing is not needed to prevent information leakage. Also change some length arguments to use the preferred sizeof form. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 16e8e444c616..9aa9d0ba6d3e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8161,7 +8161,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev->netdev_ops = &ixgbe_netdev_ops;
ixgbe_set_ethtool_ops(netdev);
netdev->watchdog_timeo = 5 * HZ;
- strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
+ strlcpy(netdev->name, pci_name(pdev), sizeof(netdev->name));
adapter->bd_number = cards_found;
@@ -8386,9 +8386,9 @@ skip_sriov:
}
ixgbe_check_minimum_link(adapter, expected_gts);
- err = ixgbe_read_pba_string_generic(hw, part_str, IXGBE_PBANUM_LENGTH);
+ err = ixgbe_read_pba_string_generic(hw, part_str, sizeof(part_str));
if (err)
- strncpy(part_str, "Unknown", IXGBE_PBANUM_LENGTH);
+ strlcpy(part_str, "Unknown", sizeof(part_str));
if (ixgbe_is_sfp(hw) && hw->phy.sfp_type != ixgbe_sfp_type_not_present)
e_dev_info("MAC: %d, PHY: %d, SFP+: %d, PBA No: %s\n",
hw->mac.type, hw->phy.type, hw->phy.sfp_type,