From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUERA-0006Sr-7r for qemu-devel@nongnu.org; Thu, 19 Jan 2017 10:15:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUER6-0006JE-Sw for qemu-devel@nongnu.org; Thu, 19 Jan 2017 10:15:40 -0500 Received: from mail-yw0-x243.google.com ([2607:f8b0:4002:c05::243]:34292) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUER6-0006Fk-Nt for qemu-devel@nongnu.org; Thu, 19 Jan 2017 10:15:36 -0500 Received: by mail-yw0-x243.google.com with SMTP id v73so4639900ywg.1 for ; Thu, 19 Jan 2017 07:15:35 -0800 (PST) From: Pranith Kumar Date: Thu, 19 Jan 2017 10:15:32 -0500 Message-Id: <20170119151533.29328-1-bobby.prani@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v4 1/2] linux-user: fix settime old value location List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: alex.bennee@linaro.org Cc: qemu-devel@nongnu.org, rth@twiddle.net, peter.maydell@linaro.org, laurent@vivier.eu, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-André Lureau old_value is the 4th argument of timer_settime(), not the 2nd. Signed-off-by: Marc-André Lureau Signed-off-by: Pranith Kumar --- linux-user/syscall.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7b77503f94..6666cef4ae 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -12024,10 +12024,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, timer_t htimer = g_posix_timers[timerid]; struct itimerspec hspec_new = {{0},}, hspec_old = {{0},}; - target_to_host_itimerspec(&hspec_new, arg3); + if (target_to_host_itimerspec(&hspec_new, arg3)) { + goto efault; + } ret = get_errno( timer_settime(htimer, arg2, &hspec_new, &hspec_old)); - host_to_target_itimerspec(arg2, &hspec_old); + if (arg4 && host_to_target_itimerspec(arg4, &hspec_old)) { + goto efault; + } } break; } -- 2.11.0