From 523e136fafe6e53ef2ff7b8ab6990e3a6dd07ebb Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 15 Dec 2011 18:46:31 +0000 Subject: [PATCH] ii_pci20kc: 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/ii_pci20kc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comedi/drivers/ii_pci20kc.c b/comedi/drivers/ii_pci20kc.c index 379bd84f..04ee679b 100644 --- a/comedi/drivers/ii_pci20kc.c +++ b/comedi/drivers/ii_pci20kc.c @@ -311,6 +311,9 @@ static int pci20006_insn_read(comedi_device * dev, comedi_subdevice * s, { pci20xxx_subdev_private *sdp = s->private; + if (insn->n == 0) + return 0; + data[0] = sdp->pci20006.last_data[CR_CHAN(insn->chanspec)]; return 1; @@ -323,6 +326,9 @@ static int pci20006_insn_write(comedi_device * dev, comedi_subdevice * s, int hi, lo; unsigned int boarddata; + if (insn->n == 0) + return 0; + sdp->pci20006.last_data[CR_CHAN(insn->chanspec)] = data[0]; boarddata = (((unsigned int)data[0] + 0x8000) & 0xffff); /* comedi-data -> board-data */ lo = (boarddata & 0xff); -- 2.26.2