From: Ian Abbott Date: Thu, 15 Dec 2011 21:07:43 +0000 (+0000) Subject: adv_pci_dio: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=33a1e5b61156388aaa07bf75217b266c0111f0c2;p=comedi.git adv_pci_dio: 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/adv_pci_dio.c b/comedi/drivers/adv_pci_dio.c index 34ff38b9..132d51a5 100644 --- a/comedi/drivers/adv_pci_dio.c +++ b/comedi/drivers/adv_pci_dio.c @@ -490,6 +490,9 @@ static int pci_8254_insn_read(comedi_device * dev, comedi_subdevice * s, unsigned int chan, chip, chipchan; unsigned long flags; + if (insn->n == 0) + return 0; + chan = CR_CHAN(insn->chanspec); /* channel on subdevice */ chip = chan / 3; /* chip on subdevice */ chipchan = chan - (3 * chip); /* channel on chip on subdevice */ @@ -510,6 +513,9 @@ static int pci_8254_insn_write(comedi_device * dev, comedi_subdevice * s, unsigned int chan, chip, chipchan; unsigned long flags; + if (insn->n == 0) + return 0; + chan = CR_CHAN(insn->chanspec); /* channel on subdevice */ chip = chan / 3; /* chip on subdevice */ chipchan = chan - (3 * chip); /* channel on chip on subdevice */