From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEVZR-0000i5-I6 for qemu-devel@nongnu.org; Wed, 10 Jun 2009 17:42:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEVZR-0000hl-5b for qemu-devel@nongnu.org; Wed, 10 Jun 2009 17:42:57 -0400 Received: from [199.232.76.173] (port=50342 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEVZQ-0000hg-Rf for qemu-devel@nongnu.org; Wed, 10 Jun 2009 17:42:56 -0400 Received: from naru.obs2.net ([84.20.150.76]:56247) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MEVZQ-0004az-6V for qemu-devel@nongnu.org; Wed, 10 Jun 2009 17:42:56 -0400 Date: Thu, 11 Jun 2009 00:42:54 +0300 From: Riku Voipio Subject: Re: [Qemu-devel] [PATCH] linux-user: remove duplicate tswap32() from do_getsockopt() Message-ID: <20090610214254.GB23525@kos.to> References: <1243893468-17849-1-git-send-email-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1243893468-17849-1-git-send-email-laurent@vivier.eu> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: qemu-devel@nongnu.org On Mon, Jun 01, 2009 at 11:57:48PM +0200, Laurent Vivier wrote: > This issue has been detected with tests/linux-tests.c: > > linux-test.c:330: getsockopt > > 327 len = sizeof(val); > 328 chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len)); > 329 if (val != SOCK_STREAM) > 330 error("getsockopt"); > > In linux-user/syscall.c:do_getsockopt(), we have: > ... > val = tswap32(val); > ... > if (put_user_u32(val, optval_addr)) > ... > > whereas "put_user_u32" calls in the end "__put_user" which uses "tswap32". > So the "val = tswap32(val);" is useless and wrong. > This patch removes it. makes sense, added to my tree. I think there might be quite a few broken swapping going around.. > Signed-off-by: Laurent Vivier > --- > linux-user/syscall.c | 1 - > 1 files changed, 0 insertions(+), 1 deletions(-) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index a0915a4..b1bba48 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -1273,7 +1273,6 @@ static abi_long do_getsockopt(int sockfd, int level, int optname, > ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv)); > if (ret < 0) > return ret; > - val = tswap32(val); > if (len > lv) > len = lv; > if (len == 4) { > -- > 1.5.6.5 > >