Module: xenomai-abe
Branch: analogy
Commit: 11932e2c75d9e3b619271aba99dfc21c59336dfd
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=11932e2c75d9e3b619271aba99dfc21c59336dfd

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Sat Dec 19 20:52:06 2009 +0100

analogy: fix a bug in the execution of a list of instructions

There was a mistake in the declaration of the structure "kernel list
of instructions". This error triggered a corruption inside the data
copied from user space.

---

 include/analogy/instruction.h      |    2 +-
 ksrc/drivers/analogy/instruction.c |    7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/analogy/instruction.h b/include/analogy/instruction.h
index 1ac7484..b1564d7 100644
--- a/include/analogy/instruction.h
+++ b/include/analogy/instruction.h
@@ -210,7 +210,7 @@ typedef struct a4l_kernel_instruction a4l_kinsn_t;
 struct a4l_kernel_instruction_list {
        unsigned int count;
        a4l_kinsn_t *insns;
-       a4l_kinsn_t *__uinsns;
+       a4l_insn_t *__uinsns;
 };
 typedef struct a4l_kernel_instruction_list a4l_kilst_t;
 
diff --git a/ksrc/drivers/analogy/instruction.c 
b/ksrc/drivers/analogy/instruction.c
index 2ca7305..5ecb366 100644
--- a/ksrc/drivers/analogy/instruction.c
+++ b/ksrc/drivers/analogy/instruction.c
@@ -203,10 +203,11 @@ int a4l_do_insn(a4l_cxt_t * cxt, a4l_kinsn_t * dsc)
        a4l_dev_t *dev = a4l_get_dev(cxt);
        int (*hdlr) (a4l_subd_t *, a4l_kinsn_t *) = NULL;
 
-
        /* Checks the subdevice index */
        if (dsc->idx_subd >= dev->transfer.nb_subd) {
-               __a4l_err("a4l_do_insn: subdevice index out of range\n");
+               __a4l_err("a4l_do_insn: "
+                         "subdevice index out of range (idx=%d)\n",
+                         dsc->idx_subd);
                return -EINVAL;
        }
 
@@ -325,7 +326,7 @@ int a4l_fill_ilstdsc(a4l_cxt_t * cxt, a4l_kilst_t * dsc, 
void *arg)
        }
 
        /* Keeps the user pointer in an opaque field */
-       dsc->__uinsns = dsc->insns;
+       dsc->__uinsns = (a4l_insn_t *)dsc->insns;
 
        dsc->insns = rtdm_malloc(dsc->count * sizeof(a4l_kinsn_t));
        if (dsc->insns == NULL)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to