From ffd3dc2117a28ac9508df1d71f6892cbc3342d04 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 15 Dec 2011 18:37:34 +0000 Subject: [PATCH] poc: 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/poc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comedi/drivers/poc.c b/comedi/drivers/poc.c index 4aa14762..3a22732e 100644 --- a/comedi/drivers/poc.c +++ b/comedi/drivers/poc.c @@ -175,6 +175,9 @@ static int readback_insn(comedi_device * dev, comedi_subdevice * s, { int chan; + if (insn->n == 0) + return 0; + chan = CR_CHAN(insn->chanspec); data[0] = ((lsampl_t *) dev->private)[chan]; @@ -192,6 +195,9 @@ static int dac02_ao_winsn(comedi_device * dev, comedi_subdevice * s, int chan; int output; + if (insn->n == 0) + return 0; + chan = CR_CHAN(insn->chanspec); ((lsampl_t *) dev->private)[chan] = data[0]; output = data[0]; -- 2.26.2