From: Ian Abbott Date: Thu, 15 Dec 2011 21:04:50 +0000 (+0000) Subject: ni_at_ao: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e576f852e8f1f35355b7586d8203386506ebe31a;p=comedi.git ni_at_ao: 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/ni_at_ao.c b/comedi/drivers/ni_at_ao.c index 17d055e6..d0dcf45e 100644 --- a/comedi/drivers/ni_at_ao.c +++ b/comedi/drivers/ni_at_ao.c @@ -434,6 +434,9 @@ static int atao_calib_insn_write(comedi_device * dev, comedi_subdevice * s, unsigned int bitstring, bit; unsigned int chan = CR_CHAN(insn->chanspec); + if (insn->n == 0) + return 0; + bitstring = ((chan & 0x7) << 8) | (data[insn->n - 1] & 0xff); for (bit = 1 << (11 - 1); bit; bit >>= 1) {