qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 21/21] linux-user: remove duplicate tswap32() from d


From: riku . voipio
Subject: [Qemu-devel] [PATCH 21/21] linux-user: remove duplicate tswap32() from do_getsockopt()
Date: Fri, 12 Jun 2009 16:50:31 +0300

From: Laurent Vivier <address@hidden>

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.

From: Laurent Vivier <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
 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 2939de8..f82dd82 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1348,7 +1348,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.6.2.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]