From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo42k-0003rp-4s for qemu-devel@nongnu.org; Tue, 20 Feb 2018 04:16:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo42i-0005iT-1J for qemu-devel@nongnu.org; Tue, 20 Feb 2018 04:16:58 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:56347) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eo42h-0005hC-Nj for qemu-devel@nongnu.org; Tue, 20 Feb 2018 04:16:55 -0500 From: Laurent Vivier Date: Tue, 20 Feb 2018 10:16:39 +0100 Message-Id: <20180220091640.10875-4-laurent@vivier.eu> In-Reply-To: <20180220091640.10875-1-laurent@vivier.eu> References: <20180220091640.10875-1-laurent@vivier.eu> Subject: [Qemu-devel] [PULL 3/4] linux-user: Fix sched_getaffinity mask size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Riku Voipio , Samuel Thibault , Laurent Vivier From: Samuel Thibault 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 Message-Id: <20180211174704.27441-1-samuel.thibault@ens-lyon.org> Signed-off-by: Laurent Vivier --- 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 effc3a0881..e24f43c4a2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10502,7 +10502,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ret = arg2; } - ret = host_to_target_cpu_mask(mask, mask_size, arg3, arg2); + if (host_to_target_cpu_mask(mask, mask_size, arg3, ret)) { + goto efault; + } } } break; -- 2.14.3