From d5c00f1c2c7442ca51806600dab6f8fe897691ab Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 15 Dec 2011 21:01:48 +0000 Subject: [PATCH] usbdux: don't access *data when insn->n == 0 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 --- comedi/drivers/usbdux.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comedi/drivers/usbdux.c b/comedi/drivers/usbdux.c index 13399711..d04008e0 100644 --- a/comedi/drivers/usbdux.c +++ b/comedi/drivers/usbdux.c @@ -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)) { -- 2.26.2