From: Ian Abbott Date: Thu, 15 Dec 2011 18:31:00 +0000 (+0000) Subject: unioxx5: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2984465175f711ae14f00a2ca3ea74ae3807fb27;p=comedi.git unioxx5: 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 --- diff --git a/comedi/drivers/unioxx5.c b/comedi/drivers/unioxx5.c index 3dc865c8..dd4cf32c 100644 --- a/comedi/drivers/unioxx5.c +++ b/comedi/drivers/unioxx5.c @@ -162,6 +162,9 @@ static int unioxx5_subdev_read(comedi_device * dev, comedi_subdevice * subdev, unioxx5_subd_priv *usp = subdev->private; int channel, type; + if (insn->n == 0) + return 0; + channel = CR_CHAN(insn->chanspec); type = usp->usp_module_type[channel / 2]; /* defining module type(analog or digital) */ @@ -182,6 +185,9 @@ static int unioxx5_subdev_write(comedi_device * dev, comedi_subdevice * subdev, unioxx5_subd_priv *usp = subdev->private; int channel, type; + if (insn->n == 0) + return 0; + channel = CR_CHAN(insn->chanspec); type = usp->usp_module_type[channel / 2]; /* defining module type(analog or digital) */