From patchwork Mon May 2 09:19:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 93614 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AD582B6F0A for ; Mon, 2 May 2011 19:19:54 +1000 (EST) Received: from localhost ([::1]:34010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpIG-0001ZP-0V for incoming@patchwork.ozlabs.org; Mon, 02 May 2011 05:19:52 -0400 Received: from eggs.gnu.org ([140.186.70.92]:54540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpHn-0001UR-Vm for qemu-devel@nongnu.org; Mon, 02 May 2011 05:19:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGpHl-0006eS-Tx for qemu-devel@nongnu.org; Mon, 02 May 2011 05:19:23 -0400 Received: from afflict.kos.to ([92.243.29.197]:56830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpHl-0006eE-MG for qemu-devel@nongnu.org; Mon, 02 May 2011 05:19:21 -0400 Received: from kos.to (a88-115-163-181.elisa-laajakaista.fi [88.115.163.181]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 659A626691; Mon, 2 May 2011 09:19:19 +0000 (UTC) Received: by kos.to (sSMTP sendmail emulation); Mon, 02 May 2011 12:19:18 +0300 From: riku.voipio@iki.fi To: qemu-devel@nongnu.org Date: Mon, 2 May 2011 12:19:10 +0300 Message-Id: <1304327950-21422-4-git-send-email-riku.voipio@iki.fi> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1304327950-21422-1-git-send-email-riku.voipio@iki.fi> References: <1304327950-21422-1-git-send-email-riku.voipio@iki.fi> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 92.243.29.197 Cc: Mike McCormack , Riku Voipio Subject: [Qemu-devel] [PATCH 3/3] Don't zero out buffer in sched_getaffinity 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 From: Mike McCormack The kernel doesn't fill the buffer provided to sched_getaffinity with zero bytes, so neither should QEMU. Signed-off-by: Mike McCormack Reviewed-by: Stefan Hajnoczi Signed-off-by: Riku Voipio --- linux-user/syscall.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5b7b8e2..279cef3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6500,20 +6500,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ret = get_errno(sys_sched_getaffinity(arg1, mask_size, mask)); if (!is_error(ret)) { - if (arg2 > ret) { - /* Zero out any extra space kernel didn't fill */ - unsigned long zero = arg2 - ret; - p = alloca(zero); - memset(p, 0, zero); - if (copy_to_user(arg3 + ret, p, zero)) { - goto efault; - } - arg2 = ret; - } - if (copy_to_user(arg3, mask, arg2)) { + if (copy_to_user(arg3, mask, ret)) { goto efault; } - ret = arg2; } } break;