Commit 3f9ac9b39bd82b51f6aa46103836ae12bcbcb22e
Committed by
Riku Voipio
1 parent
d5b3a9b6
linux-user: remove duplicate tswap32() from do_getsockopt()
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>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Showing
1 changed file
with
0 additions
and
1 deletions
linux-user/syscall.c
| ... | ... | @@ -1348,7 +1348,6 @@ static abi_long do_getsockopt(int sockfd, int level, int optname, |
| 1348 | 1348 | ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv)); |
| 1349 | 1349 | if (ret < 0) |
| 1350 | 1350 | return ret; |
| 1351 | - val = tswap32(val); | |
| 1352 | 1351 | if (len > lv) |
| 1353 | 1352 | len = lv; |
| 1354 | 1353 | if (len == 4) { | ... | ... |