From patchwork Tue Aug 12 18:53:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 379442 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 BB46114001A for ; Wed, 13 Aug 2014 04:55:55 +1000 (EST) Received: from localhost ([::1]:43591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHHEf-0005Pr-Vq for incoming@patchwork.ozlabs.org; Tue, 12 Aug 2014 14:55:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHHDh-0003zo-EI for qemu-devel@nongnu.org; Tue, 12 Aug 2014 14:54:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHHDa-0007Cq-SX for qemu-devel@nongnu.org; Tue, 12 Aug 2014 14:54:53 -0400 Received: from mail-qc0-x235.google.com ([2607:f8b0:400d:c01::235]:52925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHHDa-0007Cj-O6; Tue, 12 Aug 2014 14:54:46 -0400 Received: by mail-qc0-f181.google.com with SMTP id x13so3152833qcv.26 for ; Tue, 12 Aug 2014 11:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g6lCla192DOOXmh3+s6VTeuiQbiDWYQODDse8v/hKwY=; b=fvyJjo4rdj3C+CNIhiGTnCojHZ26bojO6J9Uyh8QZrQPg2NasGr6HlxoSH/Z3FVUGv WpZvdRULECHIh40kt88D3ytN0qMyD3wqS7qC0igIeVpgOFoM973MFm/RC7F/7D31sLL2 EZjSvw8Yj2qT3HpDl8YbVKjGhWqvyfivgxgQ6626vUxJUnD5L78SgH/QnwqnIwhwP6aK 42SNq3m0yaXWKghlm40Ahdap6fx8eO9hxe0sg/Z8O8HnwcyXasuZckVeo0jdR4sdKzsK RBtPy/9gZODnzrybotM1LuPxzNuBqCe23FIiXoqx3cQiKK3rAVLvswvp0Cdn5xFCtUOW yreA== X-Received: by 10.224.71.198 with SMTP id i6mr9856166qaj.76.1407869686126; Tue, 12 Aug 2014 11:54:46 -0700 (PDT) Received: from tmusta-sc.rchland.ibm.com (rchp4.rochester.ibm.com. [129.42.161.36]) by mx.google.com with ESMTPSA id m20sm27727128qax.25.2014.08.12.11.54.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 11:54:45 -0700 (PDT) From: Tom Musta To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Tue, 12 Aug 2014 13:53:36 -0500 Message-Id: <1407869623-11185-6-git-send-email-tommusta@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1407869623-11185-1-git-send-email-tommusta@gmail.com> References: <1407869623-11185-1-git-send-email-tommusta@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::235 Cc: peter.maydell@linaro.org, riku.voipio@linaro.org, agraf@suse.de, Tom Musta Subject: [Qemu-devel] [V2 PATCH 05/12] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Reviewed-by: David Gibson --- linux-user/syscall.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3a4f432..04f4820 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9081,12 +9081,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;