Module: xenomai-jki
Branch: for-forge
Commit: 08ced1afe6111ed006d7c2f837884317e682fbbd
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=08ced1afe6111ed006d7c2f837884317e682fbbd

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Dec 11 13:57:45 2014 +0100

cobalt/rtdm: Fix tracing of failed fd operation

Also if some fd operation failed, we trace the result via the
fd_request_status class. However, fd will then contain an error code,
not a valid pointer. Avoid dereferencing such invalid pointers and
causing an oops this way.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/cobalt/trace/cobalt-rtdm.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/trace/cobalt-rtdm.h 
b/kernel/cobalt/trace/cobalt-rtdm.h
index 953e89f..e687f0c 100644
--- a/kernel/cobalt/trace/cobalt-rtdm.h
+++ b/kernel/cobalt/trace/cobalt-rtdm.h
@@ -75,7 +75,8 @@ DECLARE_EVENT_CLASS(fd_request_status,
        TP_fast_assign(
                memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
                __entry->pid = task->pid;
-               __entry->dev    = rtdm_fd_to_context(fd)->device;
+               __entry->dev =
+                       !IS_ERR(fd) ? rtdm_fd_to_context(fd)->device : NULL;
                __entry->ufd = ufd;
        ),
 


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

Reply via email to