comedi_open: Fix null pointer dereference.
authorIan Abbott <abbotti@mev.co.uk>
Mon, 9 Feb 2009 16:51:38 +0000 (16:51 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Mon, 9 Feb 2009 16:51:38 +0000 (16:51 +0000)
comedi/comedi_fops.c

index 7fc40ca1a1defd91bd324305156b4caff86ad578..198f4d992df645a45556847ab95165a6a96443da 100644 (file)
@@ -1756,7 +1756,7 @@ static int comedi_open(struct inode *inode, struct file *file)
 {
        const unsigned minor = iminor(inode);
        struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
-       comedi_device *dev = dev_file_info->device;
+       comedi_device *dev = dev_file_info ? dev_file_info->device : NULL;
        if (dev == NULL) {
                DPRINTK("invalid minor number\n");
                return -ENODEV;