From patchwork Thu Sep 22 12:13:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 76758 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp3036qgf; Thu, 22 Sep 2016 05:29:11 -0700 (PDT) X-Received: by 10.237.60.116 with SMTP id u49mr470401qte.6.1474546935688; Thu, 22 Sep 2016 05:22:15 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v207si945555qkb.123.2016.09.22.05.22.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:22:15 -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; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn314-0005Jr-JH for patch@linaro.org; Thu, 22 Sep 2016 08:22:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2u0-00086c-Q8 for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:14:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn2tv-0006IT-PP for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:14:55 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:34112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2tv-0006IG-Hx for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:14:51 -0400 Received: by mail-lf0-f53.google.com with SMTP id y6so65846821lff.1 for ; Thu, 22 Sep 2016 05:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9yhJFyHwgaIrn5NHACgcnBirPd+0AkW810JwfNyYofo=; b=dOZNWHW+1O0bzS1X8CTHvCEhA9bj+xKKOrAspgIxI0pkSCsvSXbNOLmvoCf0DcW9NV Jw/flB3Ow8KbohcNEFmhn5pVukLRy7yLK6MPHtPDGUx73CraHuRthtzLChAxNnp2xuYk 2FepVTJqa9IagiRFpoyZKvuG+1gs1nxPcU494= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9yhJFyHwgaIrn5NHACgcnBirPd+0AkW810JwfNyYofo=; b=kdMygz071b1yD7Gr3wusv8sZklOdWxpoUpSsEExYucZgwH7FtrvuGstCCm1A1IWznz /tNu9dHxTIOINHk4PePIkQB109GAbaKUyyg97ilDRRf5cigvR/q3NV64eMnbZaIDRXbh jEkTpoJ1Yx1uxH5tOSciPiSJSGeE4pK2kqv/ClabaDDedq5oBYO8fv5+EjPtWF9tH6Sc aPPP71zG0Ie8CKDyf+FwuhrT2jSQjdES7yN6yZnyZxY8EkwF9I6VGzrFhVHEzZ6yvQ5e Vozli4woB3KsDE6n4ztmilCJyABZwSuSWtBHqHvpaaeyEd+HMOchca1VouYh+WikYimN MZ7A== X-Gm-Message-State: AE9vXwOLGwzscF4MwCjv0547K96kADXiZ0MGQSc66uzMvWhfsKduAXoy6BtF01WOhqIt2vIc X-Received: by 10.25.40.74 with SMTP id o71mr739096lfo.36.1474546430510; Thu, 22 Sep 2016 05:13:50 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id u14sm294378lja.11.2016.09.22.05.13.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:13:49 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Thu, 22 Sep 2016 15:13:21 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.53 Subject: [Qemu-devel] [PULL 01/26] linux-user: Fix handling of iovec counts 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In the kernel the length of an iovec is generally handled as an unsigned long, not an integer; fix the parameter to lock_iovec() accordingly. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.1.4 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ca06943..71f40e3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3119,7 +3119,7 @@ static abi_long do_getsockopt(int sockfd, int level, int optname, } static struct iovec *lock_iovec(int type, abi_ulong target_addr, - int count, int copy) + abi_ulong count, int copy) { struct target_iovec *target_vec; struct iovec *vec; @@ -3132,7 +3132,7 @@ static struct iovec *lock_iovec(int type, abi_ulong target_addr, errno = 0; return NULL; } - if (count < 0 || count > IOV_MAX) { + if (count > IOV_MAX) { errno = EINVAL; return NULL; } @@ -3207,7 +3207,7 @@ static struct iovec *lock_iovec(int type, abi_ulong target_addr, } static void unlock_iovec(struct iovec *vec, abi_ulong target_addr, - int count, int copy) + abi_ulong count, int copy) { struct target_iovec *target_vec; int i; @@ -3462,7 +3462,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp, { abi_long ret, len; struct msghdr msg; - int count; + abi_ulong count; struct iovec *vec; abi_ulong target_vec;