From patchwork Thu Jan 19 15:15:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9526305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8150060113 for ; Thu, 19 Jan 2017 16:07:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72E942855A for ; Thu, 19 Jan 2017 16:07:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6664C28575; Thu, 19 Jan 2017 16:07:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19DE32855A for ; Thu, 19 Jan 2017 16:07:45 +0000 (UTC) Received: from localhost ([::1]:49294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUFFY-0008H7-LK for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 Jan 2017 11:07:44 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MdQ9Mi26d+rR9SaaB96F+gxGWyQeOUeCVofX1qiUyI4=; b=LozbhHH3vAt58y2ulIlNLzrEaC/MGoa+JzwkaAgIP8Tb9VFI7n3pdm6Xe43DwJ22qm ySwOt/Ir51Kzjt6LRa0lx8JR0F4ahBdB6VfRLVdksvG5hJmTxrXYk/xcgQcQOxgyBpD2 NUA9g0kCueK3P4smHGOOChWuN3OJvm/uIaic/15fCaYIsJRnOM9wHkAMrBpLoruj+Tm3 KV6YxAW908Rjuzy7qe43dLhbz+VbthDx3f3DAxPwDZHF/Ek2VfTN86GYolZFeTUSbkQ3 bL05UWdnO5LhYaFFAMSzGCql8WbMfGZx8pAfseRiLEWLjLkF3UfkPLVJkXbOW+f2SLoI UVtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MdQ9Mi26d+rR9SaaB96F+gxGWyQeOUeCVofX1qiUyI4=; b=V5o2BsaOTudyQUxMIJ1DOw2ahLL8B6KcgDjRHZ3xXsFyKj2Qyu44U5faP3cU2HbjEI s2XJwR0GPXfGVEH7fqKNAmLPmK2QX65AIb2spWMn8oaCdzEsHJUCR4yS+xdOY+CID760 2ACeIYxAgMEwXteoRhjcwrj6Hd1fnIh1M5JJNCZYxmOURo2poV/GgvjAJNdu5E4POLXD oZ2j8mouJsw9OG0p47JZfksrztPMLhNh0dtB+f/y5HHlv2FWhHenTQc3NbE4syWNqN76 2EssgZu8fxTGYksvi67bPh4W+TXiVeGbLn41EE+vFCNH6+O6ZR/GV24YgUHuj06Rqzq9 xj8g== X-Gm-Message-State: AIkVDXKiv4CCsUoGXAkcgmKZJIL9zG74WeWFfTsEoPzCxcbXiIGlYtbk8sbPgzbOw+HY7g== X-Received: by 10.13.242.71 with SMTP id b68mr7982741ywf.49.1484838934677; Thu, 19 Jan 2017 07:15:34 -0800 (PST) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id j140sm1832473ywb.44.2017.01.19.07.15.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 07:15:34 -0800 (PST) From: Pranith Kumar To: alex.bennee@linaro.org Date: Thu, 19 Jan 2017 10:15:32 -0500 Message-Id: <20170119151533.29328-1-bobby.prani@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::243 Subject: [Qemu-devel] [PATCH v4 1/2] linux-user: fix settime old value location X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, laurent@vivier.eu, qemu-devel@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; }