From patchwork Wed May 16 18:51:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 10404759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6746B601F9 for ; Wed, 16 May 2018 19:29:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 568DA2869A for ; Wed, 16 May 2018 19:29:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B561286A0; Wed, 16 May 2018 19:29:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FSL_HELO_FAKE, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C7CC62869A for ; Wed, 16 May 2018 19:29:09 +0000 (UTC) Received: from localhost ([::1]:35181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ26m-00007H-Us for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 May 2018 15:29:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1XP-0003TJ-GI for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ1XO-0000v7-L5 for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:35 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:52561) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ1XO-0000uQ-Ea for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:34 -0400 Received: by mail-wm0-x244.google.com with SMTP id w194-v6so3864171wmf.2 for ; Wed, 16 May 2018 11:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=toao+xPAPBW0eLaRxAI6cLo06F0SuzEm7J79/TTBNQY=; b=h43nzA9YC/9DdbqnDfR6y+ojB6DyEA6AIETdnmnolMhOFrE1lbajpefjqn8xLFmLXG AUOrfy07a1qcmba5n834jAdP8GXBaLqJK4eNLxMjc/y73ez0i7jqBJly20GcyMs4uozf BZ8Uiz67a6H9/vv8Q/yTY7NS3a1pEgyFGMRIujELhW6H4wjmYuR1lR6DfOlOVIgy4xaK 766r6CVnq9U2EyDANQcDX6mqmiP83HYrJobjQVOebIbfzHPNSNTlFOfgsBZiB+9tANOE 6sQzscQNfPFDjk4bs/wJy8ADWZJtdqLDnoKZ8K3Sbs01kMYthYahWoUcoasyuVzT1n5p EEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=toao+xPAPBW0eLaRxAI6cLo06F0SuzEm7J79/TTBNQY=; b=cVL1uHxVO0zab/XMl2vXExW57WNnj2oU4ZUfho/iOvAZkQbVRxxpQyWUIyKI4rK37U Wuex9NuLSYTOkYT8omCAHyJEHZ1eIjLCvmiVQgXtrfjxxs5EMuZxRof3+LroTXE1Z5oW hGYQ9uMBVlhlQuVSe4OfdL6yyCTmTXDdt5hyFV/DkMItPAMYj3Vz/ltQ/hLkvcljp891 JgK7mpobeTnva1Bu2iqQlndfQCnvhhvGDH9QCGTUGtbwgCVefgoGqaFQ4NNqGk9D2/i0 k7nXEzpuGjro9Ml0756uS14ukb4X/EKVwCKEWFKqbHCyf4huJzUCJ8KAkBhWnKFEP9W5 hmHQ== X-Gm-Message-State: ALKqPwdCY9BUL1wDUk2ETuU1JdkuJuzRoDI9eaoqTeIIchsITnO8gDn7 xai8uCfDp7V02AxYHlomtrOADQ== X-Google-Smtp-Source: AB8JxZoza5f1s86RaK8xYVHA7wj9fNxwtcepOuneNtti7tcshjs8OfOk/vZsEsENEaJUdM8F2Nnc2Q== X-Received: by 2002:a2e:880a:: with SMTP id x10-v6mr1232485ljh.45.1526496752871; Wed, 16 May 2018 11:52:32 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id e18-v6sm524027ljk.57.2018.05.16.11.52.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:52:31 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 20:51:36 +0200 Message-Id: <20180516185146.30708-29-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180516185146.30708-1-edgar.iglesias@gmail.com> References: <20180516185146.30708-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH v3 28/38] target-microblaze: dec_msr: Plug a temp leak 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: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, sstabellini@kernel.org, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Plug a temp leak. Reported-by: Richard Henderson Signed-off-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé --- target/microblaze/translate.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 03a0289858..cf1b87c09e 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -516,12 +516,17 @@ static void dec_msr(DisasContext *dc) #if !defined(CONFIG_USER_ONLY) /* Catch read/writes to the mmu block. */ if ((sr & ~0xff) == 0x1000) { + TCGv_i32 tmp_sr; + sr &= 7; + tmp_sr = tcg_const_i32(sr); LOG_DIS("m%ss sr%d r%d imm=%x\n", to ? "t" : "f", sr, dc->ra, dc->imm); - if (to) - gen_helper_mmu_write(cpu_env, tcg_const_i32(sr), cpu_R[dc->ra]); - else - gen_helper_mmu_read(cpu_R[dc->rd], cpu_env, tcg_const_i32(sr)); + if (to) { + gen_helper_mmu_write(cpu_env, tmp_sr, cpu_R[dc->ra]); + } else { + gen_helper_mmu_read(cpu_R[dc->rd], cpu_env, tmp_sr); + } + tcg_temp_free_i32(tmp_sr); return; } #endif