From patchwork Mon Nov 10 17:44:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 409017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 196F61400F1 for ; Tue, 11 Nov 2014 04:45:10 +1100 (AEDT) Received: from localhost ([::1]:44430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnt1X-0006Se-Vn for incoming@patchwork.ozlabs.org; Mon, 10 Nov 2014 12:45:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnt0y-0005e0-1l for qemu-devel@nongnu.org; Mon, 10 Nov 2014 12:44:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xnt0p-0000if-M9 for qemu-devel@nongnu.org; Mon, 10 Nov 2014 12:44:31 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42894 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnt0p-0000iI-Fx for qemu-devel@nongnu.org; Mon, 10 Nov 2014 12:44:23 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 75E90ABC6; Mon, 10 Nov 2014 17:44:22 +0000 (UTC) From: Alexander Graf To: qemu-devel@nongnu.org Date: Mon, 10 Nov 2014 18:44:20 +0100 Message-Id: <1415641462-52468-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1415641462-52468-1-git-send-email-agraf@suse.de> References: <1415641462-52468-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: tommusta@gmail.com, riku.voipio@iki.fi, peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH 2.2 v2 1/3] linux-user: Fix timer_create timer id return type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The linux syscall to create_timer really gets an s32* parameter to store its timer id into, not an abi_ulong*. Remove the useless struct encapsulation and directly write the 32bit value into memory. Signed-off-by: Alexander Graf --- linux-user/syscall.c | 5 +---- linux-user/syscall_defs.h | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a175cc1..d012c71 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9579,7 +9579,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, /* args: clockid_t clockid, struct sigevent *sevp, timer_t *timerid */ struct sigevent host_sevp = { {0}, }, *phost_sevp = NULL; - struct target_timer_t *ptarget_timer; int clkid = arg1; int timer_index = next_free_host_timer(); @@ -9601,11 +9600,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, if (ret) { phtimer = NULL; } else { - if (!lock_user_struct(VERIFY_WRITE, ptarget_timer, arg3, 1)) { + if (put_user(0xcafe0000 | timer_index, arg3, target_timer_t)) { goto efault; } - ptarget_timer->ptr = tswap32(0xcafe0000 | timer_index); - unlock_user_struct(ptarget_timer, arg3, 1); } } break; diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index c9e6323..ebb3be1 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2564,10 +2564,7 @@ struct target_ucred { #endif - -struct target_timer_t { - abi_ulong ptr; -}; +typedef int32_t target_timer_t; #define TARGET_SIGEV_MAX_SIZE 64