From: Ian Abbott Date: Thu, 15 Dec 2011 19:52:32 +0000 (+0000) Subject: dt282x: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7ca6209a564ff97db18a1672eb08e408de426726;p=comedi.git dt282x: 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/dt282x.c b/comedi/drivers/dt282x.c index 74f1f40f..dc703f7f 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -940,6 +940,9 @@ static int dt282x_ns_to_timer(int *nanosec, int round_mode) static int dt282x_ao_insn_read(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) { + if (insn->n == 0) + return 0; + data[0] = devpriv->ao[CR_CHAN(insn->chanspec)]; return 1; @@ -951,6 +954,9 @@ static int dt282x_ao_insn_write(comedi_device * dev, comedi_subdevice * s, sampl_t d; unsigned int chan; + if (insn->n == 0) + return 0; + chan = CR_CHAN(insn->chanspec); d = data[0]; d &= (1 << boardtype.dabits) - 1;