From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StLZh-0003iw-7N for qemu-devel@nongnu.org; Mon, 23 Jul 2012 12:33:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1StLZf-0004zE-Tu for qemu-devel@nongnu.org; Mon, 23 Jul 2012 12:33:37 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:56704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StLZf-0004z9-N1 for qemu-devel@nongnu.org; Mon, 23 Jul 2012 12:33:35 -0400 Received: by bkcji1 with SMTP id ji1so4647022bkc.4 for ; Mon, 23 Jul 2012 09:33:34 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1343087364-13465-1-git-send-email-jing.huang.pku@gmail.com> References: <1343087364-13465-1-git-send-email-jing.huang.pku@gmail.com> Date: Mon, 23 Jul 2012 17:33:34 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH V4 1/3] linux-user: pass sockaddr from host to target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jing Huang Cc: riku.voipio@iki.fi, qemu-devel@nongnu.org On 24 July 2012 00:49, Jing Huang wrote: > > Signed-off-by: Jing Huang > Reviewed-by: Peter Maydell > --- > linux-user/syscall.c | 15 +++++++++++++-- > 1 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 539af3f..3319bb8 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -1256,7 +1256,6 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, > return 0; > } > > -/* ??? Should this also swap msgh->name? */ > static inline abi_long target_to_host_cmsg(struct msghdr *msgh, > struct target_msghdr *target_msgh) > { This is removing the comment from the wrong function: there's an identical one over host_to_target_cmsg() which is the one most immediately addressed by this patch. You can remove both comments, though. > @@ -1873,10 +1872,22 @@ static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg, > if (!is_error(ret)) { > len = ret; > ret = host_to_target_cmsg(msgp, &msg); > - if (!is_error(ret)) > + if (!is_error(ret)) { > + msgp->msg_namelen = tswap32(msg.msg_namelen); > + if (msg.msg_name != NULL) { > + ret = host_to_target_sockaddr(tswapal(msgp->msg_name), > + msg.msg_name, msg.msg_namelen); > + if (ret) { > + goto out; > + } > + } > + > ret = len; > + } > } > } > + > +out: > unlock_iovec(vec, target_vec, count, !send); > unlock_user_struct(msgp, target_msg, send ? 0 : 1); > return ret; > -- > 1.7.8.6 > -- PMM