Module: xenomai-2.6
Branch: master
Commit: c0c7f71abdbee265330984e331d1f01b8a969211
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=c0c7f71abdbee265330984e331d1f01b8a969211

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Thu Jan 22 21:43:02 2015 +0100

nucleus/registry: initialize vfile structure to 0

The vfile API expects the structures it receives to be fully
initialized. While structures with static storage are automatically
initialized to 0, the vfile structure passed by the registry to the
vfile API is part of a dynamically allocated structure. So, initialize
this structure to 0.

This fixes the following bug:
[23726.087793] Xenomai: bug at kernel/xenomai/nucleus/vfile.c:320
(it->vfile->entry.refcnt < 0)

Obtained when reading native semaphores exported proc entry with Xenomai
compiled with debugs on.

---

 ksrc/nucleus/registry.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/ksrc/nucleus/registry.c b/ksrc/nucleus/registry.c
index 0a5efe9..f0ab926 100644
--- a/ksrc/nucleus/registry.c
+++ b/ksrc/nucleus/registry.c
@@ -674,6 +674,7 @@ int xnregistry_enter(const char *key, void *objaddr,
        }
 
        object = link2xnobj(holder);
+       memset(&object->vfile_u, '\0', sizeof(object->vfile_u));
        xnsynch_init(&object->safesynch, XNSYNCH_FIFO, NULL);
        object->objaddr = objaddr;
        object->cstamp = ++registry_obj_stamp;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to