qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH] linux-user: remove duplicate tswap32() from do_getsockopt()
Date: Mon,  1 Jun 2009 23:57:48 +0200	[thread overview]
Message-ID: <1243893468-17849-1-git-send-email-laurent@vivier.eu> (raw)

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.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 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

             reply	other threads:[~2009-06-01 21:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01 21:57 Laurent Vivier [this message]
2009-06-10 21:42 ` [Qemu-devel] [PATCH] linux-user: remove duplicate tswap32() from do_getsockopt() Riku Voipio
2009-06-10 22:19   ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243893468-17849-1-git-send-email-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).