usbdux: don't access *data when insn->n == 0
authorIan Abbott <abbotti@mev.co.uk>
Thu, 15 Dec 2011 21:01:48 +0000 (21:01 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Thu, 15 Dec 2011 21:01:48 +0000 (21:01 +0000)
Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
comedi/drivers/usbdux.c

index 133997110646cbf856923b157a09cf789759baff..d04008e03cd87553ae98f5c7e55999a17014bae5 100644 (file)
@@ -1780,6 +1780,9 @@ static int usbdux_counter_read(comedi_device * dev, comedi_subdevice * s,
                return -EFAULT;
        }
 
+       if (insn->n == 0)
+               return 0;
+
        mutex_lock(&this_usbduxsub->mutex);
 
        if (!(this_usbduxsub->probed)) {
@@ -1813,6 +1816,9 @@ static int usbdux_counter_write(comedi_device * dev, comedi_subdevice * s,
                return -EFAULT;
        }
 
+       if (insn->n == 0)
+               return 0;
+
        mutex_lock(&this_usbduxsub->mutex);
 
        if (!(this_usbduxsub->probed)) {