From 23020ab35364f2c91133b099c2b1f7458e29aa96 Mon Sep 17 00:00:00 2001 From: Rick Jones Date: Wed, 9 Nov 2011 09:58:07 +0000 Subject: Sweep additional floors of strcpy in .get_drvinfo routines Perform another round of floor sweeping, converting the .get_drvinfo routines of additional drivers from strcpy to strlcpy along with some conversion of sprintf to snprintf. Signed-off-by: Rick Jones Signed-off-by: David S. Miller --- drivers/net/ethernet/sun/sunhme.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/net/ethernet/sun/sunhme.c') diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index cf14ab9db576..eebd52f10365 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -2457,11 +2457,11 @@ static void hme_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info { struct happy_meal *hp = netdev_priv(dev); - strcpy(info->driver, "sunhme"); - strcpy(info->version, "2.02"); + strlcpy(info->driver, "sunhme", sizeof(info->driver)); + strlcpy(info->version, "2.02", sizeof(info->version)); if (hp->happy_flags & HFLAG_PCI) { struct pci_dev *pdev = hp->happy_dev; - strcpy(info->bus_info, pci_name(pdev)); + strlcpy(info->bus_info, pci_name(pdev), sizeof(info->bus_info)); } #ifdef CONFIG_SBUS else { @@ -2469,7 +2469,8 @@ static void hme_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info struct platform_device *op = hp->happy_dev; regs = of_get_property(op->dev.of_node, "regs", NULL); if (regs) - sprintf(info->bus_info, "SBUS:%d", + snprintf(info->bus_info, sizeof(info->bus_info), + "SBUS:%d", regs->which_io); } #endif -- cgit v1.2.3 From bc12d289e10afe0205738af30883853ed0ab6883 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Fri, 16 Dec 2011 12:31:49 +0000 Subject: sunhme/PCI: use list_for_each_entry() for bus->devices traversal Replace open-coded list traversal with list_for_each_entry(). CC: David S. Miller CC: netdev@vger.kernel.org Signed-off-by: Bjorn Helgaas Signed-off-by: David S. Miller --- drivers/net/ethernet/sun/sunhme.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/net/ethernet/sun/sunhme.c') diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index eebd52f10365..09c518655db2 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -2850,7 +2850,7 @@ err_out: static int is_quattro_p(struct pci_dev *pdev) { struct pci_dev *busdev = pdev->bus->self; - struct list_head *tmp; + struct pci_dev *this_pdev; int n_hmes; if (busdev == NULL || @@ -2859,15 +2859,10 @@ static int is_quattro_p(struct pci_dev *pdev) return 0; n_hmes = 0; - tmp = pdev->bus->devices.next; - while (tmp != &pdev->bus->devices) { - struct pci_dev *this_pdev = pci_dev_b(tmp); - + list_for_each_entry(this_pdev, &pdev->bus->devices, bus_list) { if (this_pdev->vendor == PCI_VENDOR_ID_SUN && this_pdev->device == PCI_DEVICE_ID_SUN_HAPPYMEAL) n_hmes++; - - tmp = tmp->next; } if (n_hmes != 4) -- cgit v1.2.3