From patchwork Mon Jul 9 13:04:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 169815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DE0992C0089 for ; Mon, 9 Jul 2012 23:05:04 +1000 (EST) Received: from localhost ([::1]:60779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoDeA-00047L-LA for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2012 09:05:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:32871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoDe3-00047C-W8 for qemu-devel@nongnu.org; Mon, 09 Jul 2012 09:04:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoDdx-0002xK-Rl for qemu-devel@nongnu.org; Mon, 09 Jul 2012 09:04:55 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:43575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoDdx-0002wH-MK for qemu-devel@nongnu.org; Mon, 09 Jul 2012 09:04:49 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id E91991B40CE; Mon, 9 Jul 2012 13:04:45 +0000 (UTC) From: Mike Frysinger To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2012 09:04:57 -0400 Message-Id: <1341839097-4074-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.7.9.7 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 140.211.166.183 Cc: Riku Voipio Subject: [Qemu-devel] [PATCH] flatload: fix bss clearing 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 The current bss clear logic assumes the target mmap address and host address are the same. Use g2h to translate from the target address space to the host so we can call memset on it. Signed-off-by: Mike Frysinger Reviewed-by: Peter Maydell --- linux-user/flatload.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/linux-user/flatload.c b/linux-user/flatload.c index be79496..58f679e 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -660,7 +660,7 @@ static int load_flat_file(struct linux_binprm * bprm, } /* zero the BSS. */ - memset((void *)((unsigned long)datapos + data_len), 0, bss_len); + memset(g2h(datapos + data_len), 0, bss_len); return 0; }