Module: xenomai-3
Branch: next
Commit: adf0ab6fe91fe40b2949cae28f7967c39743ab60
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=adf0ab6fe91fe40b2949cae28f7967c39743ab60

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Apr 11 18:32:24 2015 +0200

cobalt/timerfd: save a redundant range check in copy to user

---

 kernel/cobalt/posix/timerfd.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/posix/timerfd.c b/kernel/cobalt/posix/timerfd.c
index d566053..90c4b3f 100644
--- a/kernel/cobalt/posix/timerfd.c
+++ b/kernel/cobalt/posix/timerfd.c
@@ -93,10 +93,10 @@ static ssize_t timerfd_read(struct rtdm_fd *fd, void __user 
*buf, size_t size)
        xnlock_put_irqrestore(&nklock, s);
 
        if (err == 0) {
-               if (aligned)
-                       err = __xn_put_user(ticks, u_ticks) ? -EFAULT : 0;
-               else
-                       err = cobalt_copy_to_user(buf, &ticks, sizeof(ticks));
+               err = aligned ? __xn_put_user(ticks, u_ticks) :
+                       __xn_copy_to_user(buf, &ticks, sizeof(ticks));
+               if (err)
+                       err =-EFAULT;
        }
 
        return err ?: sizeof(ticks);


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

Reply via email to