Received: from eggs.gnu.org ([2001:4830:134:3::10]:60425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJd4w-0005qN-CJ for qemu-devel@nongnu.org; Thu, 14 Jan 2016 03:16:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJd4s-0004Oc-8F for qemu-devel@nongnu.org; Thu, 14 Jan 2016 03:16:22 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:65241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJd4r-0004OU-Uw for qemu-devel@nongnu.org; Thu, 14 Jan 2016 03:16:18 -0500 References: <1452752664-11818-1-git-send-email-chengang@emindsoft.com.cn> From: Laurent Vivier Message-ID: <5697593A.5020304@vivier.eu> Date: Thu, 14 Jan 2016 09:15:54 +0100 MIME-Version: 1.0 In-Reply-To: <1452752664-11818-1-git-send-email-chengang@emindsoft.com.cn> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] linux-user/syscall.c: Let lv always match val in do_getsockopt() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: chengang@emindsoft.com.cn, riku.voipio@iki.fi Cc: peter.maydell@linaro.org, Chen Gang , qemu-devel@nongnu.org, rth@twiddle.net Le 14/01/2016 07:24, chengang@emindsoft.com.cn a écrit : > From: Chen Gang > > After host_to_target_sock_type(), the length of val may be changed, so > calculate the related lv, too. > > Signed-off-by: Chen Gang > --- > linux-user/syscall.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index fcdca2a..0e95f35 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -1841,6 +1841,7 @@ static abi_long do_getsockopt(int sockfd, int level, int optname, > return ret; > if (optname == SO_TYPE) { > val = host_to_target_sock_type(val); > + lv = (val >> 8) ? 4 : 1; It seems the kernel always returns sizeof(int) (for all archs), what is the aim of reducing the size ? > } > if (len > lv) > len = lv; >