Staging: altpciechdma: Null deref in altpciechdma.c remove()
authorDan Carpenter <error27@gmail.com>
Tue, 20 Jan 2009 12:07:36 +0000 (15:07 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 3 Apr 2009 21:53:28 +0000 (14:53 -0700)
If dev is NULL it prints an error message.  The error message dereferences
dev.

Compile tested only.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: Leon Woestenberg <leon.woestenberg@axon.tv>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/altpciechdma/altpciechdma.c

index 3e04a6227826cf93c353d183ed6faa91b5d014d4..27059bcc40200a4dad10a4d4aac95d1c4ad18224 100644 (file)
@@ -946,7 +946,8 @@ static void __devexit remove(struct pci_dev *dev)
        struct ape_dev *ape;
        printk(KERN_DEBUG "remove(0x%p)\n", dev);
        if ((dev == 0) || (dev->dev.driver_data == 0)) {
-               printk(KERN_DEBUG "remove(dev = 0x%p) dev->dev.driver_data = 0x%p\n", dev, dev->dev.driver_data);
+               printk(KERN_DEBUG "remove(dev = 0x%p) dev->dev.driver_data = 0x%p\n",
+                       dev, (dev? dev->dev.driver_data: NULL));
                return;
        }
        ape = (struct ape_dev *)dev->dev.driver_data;