[PATCH] Dereference in tokenring/olympic.c
authorEric Sesterhenn <snakebyte@gmx.de>
Wed, 21 Jun 2006 14:17:17 +0000 (16:17 +0200)
committerJeff Garzik <jeff@garzik.org>
Fri, 23 Jun 2006 03:24:18 +0000 (23:24 -0400)
hi,

coverity found (bug id #225) that we might call free_netdev()
with NULL argument, when alloc_trdev() fails. This patch
changes the goto, so we dont call free_netdev() for
dev == NULL.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/tokenring/olympic.c

index 23032a7bc0a93b996e81b099194a7779fd63a69c..c3cb8d26cfe305241efd33ad5c00594d23f349fb 100644 (file)
@@ -217,7 +217,7 @@ static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device
        dev = alloc_trdev(sizeof(struct olympic_private)) ; 
        if (!dev) {
                i = -ENOMEM; 
-               goto op_free_dev;
+               goto op_release_dev;
        }
 
        olympic_priv = dev->priv ;
@@ -282,8 +282,8 @@ op_free_iomap:
        if (olympic_priv->olympic_lap)
                iounmap(olympic_priv->olympic_lap);
 
-op_free_dev:
        free_netdev(dev);
+op_release_dev:
        pci_release_regions(pdev); 
 
 op_disable_dev: