Commit 339de30f authored by Mark Rustad's avatar Mark Rustad Committed by Jeff Kirsher

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: default avatarMark Rustad <mark.d.rustad@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 508a8c9e
......@@ -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 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment