From 3240a55ffbaf12b6e72cec6755fd6183f930298c Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 8 Nov 2002 21:49:28 +0000 Subject: [PATCH] Add debugging --- comedi/comedi_fops.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index a575cb8e..410a314b 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -513,34 +513,41 @@ static int do_insnlist_ioctl(comedi_device *dev,void *arg,void *file) if(copy_from_user(&insnlist,arg,sizeof(comedi_insnlist))) return -EFAULT; - if(insnlist.n_insns>=MAX_INSNS) + if(insnlist.n_insns>=MAX_INSNS){ + DPRINTK("insnlist too long\n"); return -EINVAL; + } data=kmalloc(sizeof(lsampl_t)*MAX_SAMPLES,GFP_KERNEL); if(!data){ + DPRINTK("kmalloc failed\n"); ret = -ENOMEM; goto error; } insns=kmalloc(sizeof(comedi_insn)*insnlist.n_insns,GFP_KERNEL); if(!insns){ + DPRINTK("kmalloc failed\n"); ret = -ENOMEM; goto error; } if(copy_from_user(insns,insnlist.insns,sizeof(comedi_insn)*insnlist.n_insns)){ + DPRINTK("copy_from_user failed\n"); ret=-EFAULT; goto error; } for(i=0;iMAX_SAMPLES){ + DPRINTK("number of samples too large\n"); ret=-EINVAL; goto error; } if(insns[i].insn&INSN_MASK_WRITE){ if(copy_from_user(data,insns[i].data, insns[i].n*sizeof(lsampl_t))){ + DPRINTK("copy_from_user failed\n"); ret=-EFAULT; goto error; } @@ -555,6 +562,7 @@ static int do_insnlist_ioctl(comedi_device *dev,void *arg,void *file) if(insns[i].insn&INSN_MASK_READ){ if(copy_to_user(insns[i].data,data, insns[i].n*sizeof(lsampl_t))){ + DPRINTK("copy_to_user failed\n"); ret=-EFAULT; goto error; } -- 2.26.2