diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-15 16:12:06 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-15 16:12:06 +0000 |
commit | be09ac4194bd0a61c0d9412c32431fbe2273cba1 (patch) | |
tree | 8b8c8c1359c03703b5b7491025c602c9e401b417 /linux-user | |
parent | 607175e0fb53f5f207fb9a1e8340566e616735aa (diff) | |
download | qemu-be09ac4194bd0a61c0d9412c32431fbe2273cba1.zip qemu-be09ac4194bd0a61c0d9412c32431fbe2273cba1.tar.gz qemu-be09ac4194bd0a61c0d9412c32431fbe2273cba1.tar.bz2 |
linux-user: removed unnecessary MAX_SOCK_ADDR checks for socket syscalls
- This check is not needed because kernel will check whether given
buffer is too small and there is no upper limit for size of the buffer.
From: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7117 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/syscall.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 12650cc..0ea4ea9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1208,16 +1208,13 @@ static abi_long do_socket(int domain, int type, int protocol) return get_errno(socket(domain, type, protocol)); } -/* MAX_SOCK_ADDR from linux/net/socket.c */ -#define MAX_SOCK_ADDR 128 - /* do_bind() Must return target values and target errnos. */ static abi_long do_bind(int sockfd, abi_ulong target_addr, socklen_t addrlen) { void *addr; - if (addrlen < 0 || addrlen > MAX_SOCK_ADDR) + if (addrlen < 0) return -TARGET_EINVAL; addr = alloca(addrlen+1); @@ -1232,7 +1229,7 @@ static abi_long do_connect(int sockfd, abi_ulong target_addr, { void *addr; - if (addrlen < 0 || addrlen > MAX_SOCK_ADDR) + if (addrlen < 0) return -TARGET_EINVAL; addr = alloca(addrlen); @@ -1307,7 +1304,7 @@ static abi_long do_accept(int fd, abi_ulong target_addr, if (get_user_u32(addrlen, target_addrlen_addr)) return -TARGET_EFAULT; - if (addrlen < 0 || addrlen > MAX_SOCK_ADDR) + if (addrlen < 0) return -TARGET_EINVAL; addr = alloca(addrlen); @@ -1332,7 +1329,7 @@ static abi_long do_getpeername(int fd, abi_ulong target_addr, if (get_user_u32(addrlen, target_addrlen_addr)) return -TARGET_EFAULT; - if (addrlen < 0 || addrlen > MAX_SOCK_ADDR) + if (addrlen < 0) return -TARGET_EINVAL; addr = alloca(addrlen); @@ -1360,7 +1357,7 @@ static abi_long do_getsockname(int fd, abi_ulong target_addr, if (get_user_u32(addrlen, target_addrlen_addr)) return -TARGET_EFAULT; - if (addrlen < 0 || addrlen > MAX_SOCK_ADDR) + if (addrlen < 0) return -TARGET_EINVAL; addr = alloca(addrlen); @@ -1398,7 +1395,7 @@ static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags, void *host_msg; abi_long ret; - if (addrlen < 0 || addrlen > MAX_SOCK_ADDR) + if (addrlen < 0) return -TARGET_EINVAL; host_msg = lock_user(VERIFY_READ, msg, len, 1); @@ -1433,7 +1430,7 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags, ret = -TARGET_EFAULT; goto fail; } - if (addrlen < 0 || addrlen > MAX_SOCK_ADDR) { + if (addrlen < 0) { ret = -TARGET_EINVAL; goto fail; } |