From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA08V-0001zV-Gf for qemu-devel@nongnu.org; Mon, 06 Jun 2016 15:24:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bA08T-0004NF-HQ for qemu-devel@nongnu.org; Mon, 06 Jun 2016 15:24:30 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA08T-0004MR-7j for qemu-devel@nongnu.org; Mon, 06 Jun 2016 15:24:29 -0400 From: Peter Maydell Date: Mon, 6 Jun 2016 19:58:02 +0100 Message-Id: <1465239499-5048-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> References: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 01/18] linux-user: Use safe_syscall wrapper for readv and writev syscalls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Laurent Vivier Use the safe_syscall wrapper for readv and writev syscalls. Signed-off-by: Peter Maydell --- linux-user/syscall.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 31a9484..28f7244 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -699,6 +699,8 @@ safe_syscall2(int, rt_sigsuspend, sigset_t *, newset, size_t, sigsetsize) safe_syscall2(int, kill, pid_t, pid, int, sig) safe_syscall2(int, tkill, int, tid, int, sig) safe_syscall3(int, tgkill, int, tgid, int, pid, int, sig) +safe_syscall3(ssize_t, readv, int, fd, const struct iovec *, iov, int, iovcnt) +safe_syscall3(ssize_t, writev, int, fd, const struct iovec *, iov, int, iovcnt) static inline int host_to_target_sock_type(int host_type) { @@ -8345,7 +8347,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct iovec *vec = lock_iovec(VERIFY_WRITE, arg2, arg3, 0); if (vec != NULL) { - ret = get_errno(readv(arg1, vec, arg3)); + ret = get_errno(safe_readv(arg1, vec, arg3)); unlock_iovec(vec, arg2, arg3, 1); } else { ret = -host_to_target_errno(errno); @@ -8356,7 +8358,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1); if (vec != NULL) { - ret = get_errno(writev(arg1, vec, arg3)); + ret = get_errno(safe_writev(arg1, vec, arg3)); unlock_iovec(vec, arg2, arg3, 0); } else { ret = -host_to_target_errno(errno); -- 1.9.1