From patchwork Fri Aug 19 15:39:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 1668224 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=lihKwPGj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M8R6f2Ly7z1yg7 for ; Sat, 20 Aug 2022 01:50:34 +1000 (AEST) Received: from localhost ([::1]:60992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP4GU-00067h-Jp for incoming@patchwork.ozlabs.org; Fri, 19 Aug 2022 11:50:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oP46B-0005k5-1u for qemu-ppc@nongnu.org; Fri, 19 Aug 2022 11:39:51 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:45765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oP465-00064u-8s for qemu-ppc@nongnu.org; Fri, 19 Aug 2022 11:39:50 -0400 Received: by mail-wr1-x429.google.com with SMTP id z16so5602286wrh.12 for ; Fri, 19 Aug 2022 08:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MdveKL4MP90EdNQkpPRlvAKQ9ASmc2UjMbS6E+1HF1Q=; b=lihKwPGjA0DKnwXPdntU6GoO4IsgZ9k/4gQznM+g11xVB/9U9nbvIRDhzSaXbwnLY6 CUc+J+ULKLAmRls3veAO+02/NAVJSc6efljwzsZ5bfTLYzB4BJ9f4GnUkadUf9UTf341 AFiGAoBYxJXhTiXLFWaURNoDxffX9Dmyo23lSSSVN/Wm7uQ5dzMLew2qGJN1Ji5AK0uw EKtCH7aG2QI+CEEi3/AfFfTAgkRuiNHyvCwntiC3ENJfGT0AleM+ifLM7HzYxuQPwdAL D4ARWrj8jYXx+UOG2Bmn90vCyV7bHmCLBhpW0XGyxlAGfteANnv7c+ki/6iUtkKxkYXA rWQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MdveKL4MP90EdNQkpPRlvAKQ9ASmc2UjMbS6E+1HF1Q=; b=pIrO7ffYUk8VChJifZ33TETHshywQ2akLlsO6S3v5SYRcueXezMiH3K7JeIKmefnE4 zJTYs8qirqsmQko17uH0ySvwS5iHDHzPUfWAlLlsjAcPjtPMlpxBb03u9wbnuhvnDLE5 OIZ57ih4aJjns56QqxAM3auORcdKPWMhtBiJm3KiJL2POL5noe2D1ubEs/DLNNDIBcj6 T9GvMyffSIGGXC2EOPpIC1hI9mIe4NlQInficcjSFOCkIGIzysXQQK4EfqEnQlSHDEli 380SptaiP088wnRRfFRGiqI//OQda4QZ2QmnW9EHBPr8A1cwRHkbPHE1Q+SikTWB5i6B +17A== X-Gm-Message-State: ACgBeo0E2gMVBXZf67H9MhsHrILPV/fTJ+emsWA05C32W9HpUtmuXBy7 fPFe0f/EaZFhVKRzHdY0YWWfhQ== X-Google-Smtp-Source: AA6agR4ev68+RW+xxmy99eXOV+AlqS6M1f/wmO9AecmbCxg3txCKqDiVxs4WXWzuDt4KpTTgrXXFjg== X-Received: by 2002:a5d:4301:0:b0:21b:8af6:4a21 with SMTP id h1-20020a5d4301000000b0021b8af64a21mr4766102wrq.296.1660923583981; Fri, 19 Aug 2022 08:39:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bi13-20020a05600c3d8d00b003a54109a6a0sm5558396wmb.3.2022.08.19.08.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 08:39:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Samuel Thibault , =?utf-8?q?Marc-Andr=C3=A9_L?= =?utf-8?q?ureau?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Daniel Henrique Barboza , David Gibson , Greg Kurz , Dmitry Fleytman , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org Subject: [PATCH v2 07/11] hw/intc/xics: Avoid dynamic stack allocation Date: Fri, 19 Aug 2022 16:39:27 +0100 Message-Id: <20220819153931.3147384-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220819153931.3147384-1-peter.maydell@linaro.org> References: <20220819153931.3147384-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-ppc@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-ppc" From: Philippe Mathieu-Daudé Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson Reviewed-by: Greg Kurz Signed-off-by: Peter Maydell --- hw/intc/xics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 5b0b4d96242..dcd021af668 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -567,8 +567,8 @@ static void ics_reset_irq(ICSIRQState *irq) static void ics_reset(DeviceState *dev) { ICSState *ics = ICS(dev); + g_autofree uint8_t *flags = g_malloc(ics->nr_irqs); int i; - uint8_t flags[ics->nr_irqs]; for (i = 0; i < ics->nr_irqs; i++) { flags[i] = ics->irqs[i].flags;