From nobody Mon Apr 29 12:58:00 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 1518371312275976.2425591101908; Sun, 11 Feb 2018 09:48:32 -0800 (PST) Received: from localhost ([::1]:36589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekvji-0003cw-19 for importer@patchew.org; Sun, 11 Feb 2018 12:48:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekvia-00038Y-Dk for qemu-devel@nongnu.org; Sun, 11 Feb 2018 12:47:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekviX-0003a5-61 for qemu-devel@nongnu.org; Sun, 11 Feb 2018 12:47:12 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:38714) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ekviW-0003XU-To for qemu-devel@nongnu.org; Sun, 11 Feb 2018 12:47:09 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 9C6F0F85A; Sun, 11 Feb 2018 18:47:05 +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 cgY3g5-N48el; Sun, 11 Feb 2018 18:47:05 +0100 (CET) Received: from var.youpi.perso.aquilenet.fr (dhcp-97-227.dsi-ext.ens-lyon.fr [140.77.97.227]) by hera.aquilenet.fr (Postfix) with ESMTPSA id F0A4C72D; Sun, 11 Feb 2018 18:47:04 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.90) (envelope-from ) id 1ekviS-00079I-KN; Sun, 11 Feb 2018 18:47:04 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Sun, 11 Feb 2018 18:47:04 +0100 Message-Id: <20180211174704.27441-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] [PATCHv2] 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 used it. Also, we need to return the capped mask size instead of 0 on success. Signed-off-by: Samuel Thibault Reviewed-by: Laurent Vivier --- Difference from v1: - simplify fix --- linux-user/syscall.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 82b35a6bdf..bcda3362fc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10493,7 +10493,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_lon= g arg1, ret =3D arg2; } =20 - ret =3D host_to_target_cpu_mask(mask, mask_size, arg3, arg= 2); + if (host_to_target_cpu_mask(mask, mask_size, arg3, ret)) { + goto efault; + } } } break; --=20 2.15.1