From patchwork Tue Aug 19 08:32:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35573 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D7B32136C for ; Tue, 19 Aug 2014 08:46:33 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id ij19sf19199957vcb.8 for ; Tue, 19 Aug 2014 01:46:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=E+etlYh5vArzCsMUBeVYOoayV5nnHr0pDPvrt+SLYHQ=; b=l1/MhP41nzd7JXSODq7O7VkE+cIHg8yHE7unOQNVcdJCa/zgSOI/zFk7yLLSeD27mE sXLLI2rsrfGzwYQXIJzMDYCZxJHpmFm8wbHGvhvZ2ArkVfcra0kdS0LWTOO9mZ2P9wC4 N9IZc62aXL8kwqjQOox75+d/RYll6D8mfj+Jbf2JK4EGbjC8EZF2fFrZg5IC1YxtiJO6 UePefSyBYLS8Aj0ZCrc6p13Pp5zhJIOZBWdC14bkajbdSq9UW648n/QLT917X4GIGsnc nMq8ELtIWqA8UXowYLEp0Rpjv9QE2SUNY1kxfcjvyzVh64NGeRs0iJ9LlW/74wn0EiFR zAmg== X-Gm-Message-State: ALoCoQk51CBAiEhFxDH4GGEQD8gxX2AyexJ24aBjJ9thra8hAgnSbkbqjW0Dnsk2dd0fKt5T0rhG X-Received: by 10.52.182.66 with SMTP id ec2mr3614034vdc.0.1408437992816; Tue, 19 Aug 2014 01:46:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.105 with SMTP id o96ls104049qgo.35.gmail; Tue, 19 Aug 2014 01:46:32 -0700 (PDT) X-Received: by 10.52.146.17 with SMTP id sy17mr1823613vdb.29.1408437992694; Tue, 19 Aug 2014 01:46:32 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id rd6si8352634vcb.39.2014.08.19.01.46.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:46:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so7034498vcb.38 for ; Tue, 19 Aug 2014 01:46:32 -0700 (PDT) X-Received: by 10.52.246.198 with SMTP id xy6mr4728519vdc.7.1408437992566; Tue, 19 Aug 2014 01:46:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp220971vcb; Tue, 19 Aug 2014 01:46:32 -0700 (PDT) X-Received: by 10.224.130.7 with SMTP id q7mr65962205qas.42.1408437991962; Tue, 19 Aug 2014 01:46:31 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w8si28007076qcj.35.2014.08.19.01.46.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:46:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJf3n-0006Pa-Gd for patch@linaro.org; Tue, 19 Aug 2014 04:46:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeqv-00016Z-Hd for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJeql-0001aZ-S7 for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:13 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=50311 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeql-0001ZL-Lu for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:03 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 1A7B926646; Tue, 19 Aug 2014 10:33:02 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 19 Aug 2014 11:32:49 +0300 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: Tom Musta Subject: [Qemu-devel] [PULL v2 14/23] linux-user: Conditionally Pass Attribute Pointer to mq_open() 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Tom Musta The mq_open system call takes an optional struct mq_attr pointer argument in the fourth position. This pointer is used when O_CREAT is specified in the flags (second) argument. It may be NULL, in which case the queue is created with implementation defined attributes. Change the code to properly handle the case when NULL is passed in the arg4 position. Signed-off-by: Tom Musta Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index db40829..c9a9d3d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9185,12 +9185,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #if defined(TARGET_NR_mq_open) && defined(__NR_mq_open) case TARGET_NR_mq_open: { - struct mq_attr posix_mq_attr; + struct mq_attr posix_mq_attr, *attrp; p = lock_user_string(arg1 - 1); - if (arg4 != 0) + if (arg4 != 0) { copy_from_user_mq_attr (&posix_mq_attr, arg4); - ret = get_errno(mq_open(p, arg2, arg3, &posix_mq_attr)); + attrp = &posix_mq_attr; + } else { + attrp = 0; + } + ret = get_errno(mq_open(p, arg2, arg3, attrp)); unlock_user (p, arg1, 0); } break;