Received: from eggs.gnu.org ([2001:4830:134:3::10]:39783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJbLd-0000xs-DW for qemu-devel@nongnu.org; Thu, 14 Jan 2016 01:25:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJbLZ-0004do-9G for qemu-devel@nongnu.org; Thu, 14 Jan 2016 01:25:29 -0500 Received: from out1134-177.mail.aliyun.com ([42.120.134.177]:10404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJbLY-0004Xh-RF for qemu-devel@nongnu.org; Thu, 14 Jan 2016 01:25:25 -0500 From: chengang@emindsoft.com.cn Date: Thu, 14 Jan 2016 14:24:24 +0800 Message-Id: <1452752664-11818-1-git-send-email-chengang@emindsoft.com.cn> Subject: [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: riku.voipio@iki.fi, laurent@vivier.eu Cc: peter.maydell@linaro.org, Chen Gang , Chen Gang , qemu-devel@nongnu.org, rth@twiddle.net 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; } if (len > lv) len = lv; -- 1.9.1