From: Ian Abbott Date: Thu, 15 Dec 2011 19:32:31 +0000 (+0000) Subject: ke_counter: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=da0d83332f9719c61b16b70ecbf76253a459d280;p=comedi.git ke_counter: 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/ke_counter.c b/comedi/drivers/ke_counter.c index 7e08bea8..d14bcb62 100644 --- a/comedi/drivers/ke_counter.c +++ b/comedi/drivers/ke_counter.c @@ -104,6 +104,9 @@ static int cnt_winsn(comedi_device * dev, { int chan = CR_CHAN(insn->chanspec); + if (insn->n == 0) + return 0; + outb((unsigned char)((data[0] >> 24) & 0xff), dev->iobase + chan * 0x20 + 0x10); outb((unsigned char)((data[0] >> 16) & 0xff), @@ -126,6 +129,9 @@ static int cnt_rinsn(comedi_device * dev, int chan = CR_CHAN(insn->chanspec); int result; + if (insn->n == 0) + return 0; + a0 = inb(dev->iobase + chan * 0x20); a1 = inb(dev->iobase + chan * 0x20 + 0x04); a2 = inb(dev->iobase + chan * 0x20 + 0x08);