From nobody Sun Apr 28 21:53:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516991872585702.516392553113; Fri, 26 Jan 2018 10:37:52 -0800 (PST) Received: from localhost ([::1]:44759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef8se-0006RC-Ns for importer@patchew.org; Fri, 26 Jan 2018 13:37:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef8rg-00061U-KA for qemu-devel@nongnu.org; Fri, 26 Jan 2018 13:36:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef8rf-0003lM-MD for qemu-devel@nongnu.org; Fri, 26 Jan 2018 13:36:40 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:33960) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ef8rf-0003kb-9h for qemu-devel@nongnu.org; Fri, 26 Jan 2018 13:36:39 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 054C710FF1; Fri, 26 Jan 2018 19:36:38 +0100 (CET) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bIALsBsiJ4j9; Fri, 26 Jan 2018 19:36:37 +0100 (CET) Received: from var.youpi.perso.aquilenet.fr (unknown [IPv6:2a01:cb19:181:c200:3602:86ff:fe2c:6a19]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 6652C10FE2; Fri, 26 Jan 2018 19:36:37 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.90) (envelope-from ) id 1ef8rc-0001z4-UB; Fri, 26 Jan 2018 19:36:36 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Fri, 26 Jan 2018 19:36:36 +0100 Message-Id: <20180126183636.7586-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.15.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PATCH] linux-user: Fix sched_getaffinity mask size 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: Samuel Thibault , Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We properly computed the capped mask size to be put to the application buffer, but didn't actually it. Also, we need to return the capped mask size instead of 0 on success. Signed-off-by: Samuel Thibault --- linux-user/syscall.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 74378947f0..cf2369aac2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10496,10 +10496,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_l= ong arg1, ret =3D -TARGET_EINVAL; break; } - ret =3D arg2; + } else if (arg2 > ret) { + arg2 =3D ret; } =20 ret =3D host_to_target_cpu_mask(mask, mask_size, arg3, arg= 2); + + if (ret =3D=3D 0) { + ret =3D arg2; + } } } break; --=20 2.15.1