From: Ian Abbott Date: Thu, 15 Dec 2011 20:56:11 +0000 (+0000) Subject: amplc_dio200: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0dc53f40d22adb80251f39d28a4fe8c6af785ca3;p=comedi.git amplc_dio200: 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/amplc_dio200.c b/comedi/drivers/amplc_dio200.c index 8f54b264..fc960ef5 100644 --- a/comedi/drivers/amplc_dio200.c +++ b/comedi/drivers/amplc_dio200.c @@ -1041,6 +1041,9 @@ dio200_subdev_8254_read(comedi_device * dev, comedi_subdevice * s, int chan = CR_CHAN(insn->chanspec); unsigned long flags; + if (insn->n == 0) + return 0; + comedi_spin_lock_irqsave(&subpriv->spinlock, flags); data[0] = i8254_read(subpriv->iobase, 0, chan); comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); @@ -1059,6 +1062,9 @@ dio200_subdev_8254_write(comedi_device * dev, comedi_subdevice * s, int chan = CR_CHAN(insn->chanspec); unsigned long flags; + if (insn->n == 0) + return 0; + comedi_spin_lock_irqsave(&subpriv->spinlock, flags); i8254_write(subpriv->iobase, 0, chan, data[0]); comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags);