Module: xenomai-3
Branch: wip/rtnet-fixes
Commit: a9e0c0a735ae23a58f05c1408e244a3f9cfdc910
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a9e0c0a735ae23a58f05c1408e244a3f9cfdc910

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Jan  7 18:24:18 2018 +0100

net/packet: ioctl: remove direct references to user memory (3)

---

 kernel/drivers/net/stack/packet/af_packet.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/drivers/net/stack/packet/af_packet.c 
b/kernel/drivers/net/stack/packet/af_packet.c
index 56daba8..9fa985d 100644
--- a/kernel/drivers/net/stack/packet/af_packet.c
+++ b/kernel/drivers/net/stack/packet/af_packet.c
@@ -305,7 +305,7 @@ static int rt_packet_ioctl(struct rtdm_fd *fd, unsigned int 
request, void __user
  *  rt_packet_recvmsg
  */
 static ssize_t
-rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr *msg, int msg_flags)
+rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr *u_msg, int msg_flags)
 {
     struct rtsocket     *sock = rtdm_fd_to_private(fd);
     ssize_t             len;
@@ -314,11 +314,11 @@ rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr 
*msg, int msg_flags)
     struct sockaddr_ll  sll;
     int                        ret, flags;
     nanosecs_rel_t      timeout = sock->timeout;
-    struct user_msghdr _msg;
+    struct user_msghdr _msg, *msg;
     socklen_t namelen;
     struct iovec iov_fast[RTDM_IOV_FASTMAX], *iov;
 
-    msg = rtnet_get_arg(fd, &_msg, msg, sizeof(*msg));
+    msg = rtnet_get_arg(fd, &_msg, u_msg, sizeof(_msg));
     if (IS_ERR(msg))
            return PTR_ERR(msg);
    
@@ -364,12 +364,12 @@ rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr 
*msg, int msg_flags)
        /* Ethernet specific - we rather need some parse handler here */
        memcpy(sll.sll_addr, rtskb->mac.ethernet->h_source, ETH_ALEN);
        sll.sll_halen = ETH_ALEN;
-       ret = rtnet_put_arg(fd, &msg->msg_name, &sll, sizeof(sll));
+       ret = rtnet_put_arg(fd, msg->msg_name, &sll, sizeof(sll));
        if (ret)
                goto fail;
 
        namelen = sizeof(sll);
-       ret = rtnet_put_arg(fd, &msg->msg_namelen, &namelen, sizeof(namelen));
+       ret = rtnet_put_arg(fd, &u_msg->msg_namelen, &namelen, sizeof(namelen));
        if (ret)
                goto fail;
     }
@@ -389,7 +389,7 @@ rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr 
*msg, int msg_flags)
     if (copy_len > len) {
        copy_len = len;
        flags = msg->msg_flags | MSG_TRUNC;
-       ret = rtnet_put_arg(fd, &msg->msg_flags, &flags, sizeof(flags));
+       ret = rtnet_put_arg(fd, &u_msg->msg_flags, &flags, sizeof(flags));
        if (ret)
                goto fail;
     }


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

Reply via email to