From: Ian Abbott Date: Thu, 15 Dec 2011 20:24:17 +0000 (+0000) Subject: addi_common: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=23813432ec7ec3681bf90f4ad2a08afd573ee9f3;p=comedi.git addi_common: 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. The INSN_READ handler for the EEPROM was ignoring insn->n. Signed-off-by: Ian Abbott --- diff --git a/comedi/drivers/addi-data/addi_common.c b/comedi/drivers/addi-data/addi_common.c index 01870467..3495e318 100644 --- a/comedi/drivers/addi-data/addi_common.c +++ b/comedi/drivers/addi-data/addi_common.c @@ -3066,6 +3066,9 @@ static int i_ADDIDATA_InsnReadEeprom(comedi_device * dev, comedi_subdevice * s, WORD w_Address; w_Address = CR_CHAN(insn->chanspec); // address to be read as 0,1,2,3...255 + if (insn->n == 0) + return 0; + w_Data = w_EepromReadWord(devpriv->i_IobaseAmcc, this_board->pc_EepromChip, 0x100 + (2 * w_Address)); data[0] = w_Data;