projects
/
comedi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
29917f7
)
Added check against maxdata for write instructions.
author
Frank Mori Hess
<fmhess@speakeasy.net>
Thu, 25 Oct 2007 19:49:14 +0000
(19:49 +0000)
committer
Frank Mori Hess
<fmhess@speakeasy.net>
Thu, 25 Oct 2007 19:49:14 +0000
(19:49 +0000)
comedi/comedi_fops.c
patch
|
blob
|
history
diff --git
a/comedi/comedi_fops.c
b/comedi/comedi_fops.c
index d1a69a86af7491e93f2c11cd312afddcf37ad8c3..29134bdc140f3c4a444e0f7d2f605b18fe791328 100644
(file)
--- a/
comedi/comedi_fops.c
+++ b/
comedi/comedi_fops.c
@@
-663,6
+663,7
@@
static int parse_insn(comedi_device *dev,comedi_insn *insn,lsampl_t *data,void *
{
comedi_subdevice *s;
int ret = 0;
+ int i;
if(insn->insn&INSN_MASK_SPECIAL){
/* a non-subdevice instruction */
@@
-760,8
+761,12
@@
static int parse_insn(comedi_device *dev,comedi_insn *insn,lsampl_t *data,void *
ret=s->insn_read(dev,s,insn,data);
break;
case INSN_WRITE:
- //XXX check against subdevice's maxdata
- ret=s->insn_write(dev,s,insn,data);
+ for(i = 0; i < insn->n; ++i)
+ {
+ if(data[i] > s->maxdata) ret = -EINVAL;
+ }
+ if(ret == 0)
+ ret = s->insn_write(dev,s,insn,data);
break;
case INSN_BITS:
if(insn->n != 2)