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: 598505 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1500302mae; Fri, 19 Aug 2022 08:44:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR5d9ArpaM5bKj5+J4PcXVnGFnDvwg7JcoMk0/hqqsT3gQrMtofP41uV6ahpE7SYOqxDqJZw X-Received: by 2002:ad4:5dcd:0:b0:476:a48d:4c43 with SMTP id m13-20020ad45dcd000000b00476a48d4c43mr7080211qvh.13.1660923892022; Fri, 19 Aug 2022 08:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660923892; cv=none; d=google.com; s=arc-20160816; b=qGRvbB5vxNvYaplI1xQEj36IHA37GBZtdQXz/nxbA5ofYxZkbTrJCF3SpSCFWGzNQn hdH6hJN4fbsJb8lKr6Lbg7NZ2n6S9Ll7UgZ7zRQPxLYrHA7AvOWAEAzvz1+uCK2Melzj IFnHA61kQV9Nw473uArP8puzDH8Lr+j4uUol/IXnHxYmxQc/qbUuUmVop8HrMpsl6DM5 6sMxY2NtCoq/vVF5J+6/TOlcyteloB7kRn0qXU0vdz9WboRsqOF7zQMy4HvfeXK5LGEh B9TMcEIU6SaWSkeQnsZbRU0aC8eroDP2lkjI8Gh/pVZbA2UJqYWo4se6ehy2Xx+hgrZp Iujg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MdveKL4MP90EdNQkpPRlvAKQ9ASmc2UjMbS6E+1HF1Q=; b=p6RuaxwIkSzqpMo+e92q/J37vHIIhxd9mavujsg/mWxxs9ALfBQAg6tk3YVMgdI7WZ heUf3j/Qzwc4cAt7jJAXes+S4ZrUwW4Rql4fw1Uxp1RHmIMZWS08bHxCvlgPX1QF3UoB Fp8X47ygfy6WE8XDxX7wyEDDKyq/wy9euR2MUxAYeu38cDXPOeMo04gDrwFE6ZFxxNb/ WHVufgByj/NCmRtagIaw9ifgX8iyMryHk7xtQ5eVE/iMti69ZqyKmzhKlM/U9v/IoNuN r3RKDW+DXfmDOzr+auZmdrrzVya0QiuNKBn02syDsyvkUD6Vm85tXLokXXBYq5cl36u9 YHHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lihKwPGj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 14-20020ad45bae000000b004967ffe7aa3si2021616qvq.37.2022.08.19.08.44.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Aug 2022 08:44:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lihKwPGj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP4B1-0006Kb-LS for patch@linaro.org; Fri, 19 Aug 2022 11:44:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oP46D-0005lZ-Ih for qemu-devel@nongnu.org; Fri, 19 Aug 2022 11:39:53 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:39655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oP465-00064w-Bl for qemu-devel@nongnu.org; Fri, 19 Aug 2022 11:39:53 -0400 Received: by mail-wr1-x435.google.com with SMTP id r16so5619823wrm.6 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=Thbn5YsOkuiDJmr5JlTC1fXFcMcDFOB2dzwqRgdE8AaOhN+Z9W1bHpz5ZDu6yDs4mG 9s7/SfvQHj+EOiFXYtgZ6gr7DJtpKkYouj2hir4iJkPaeWBwlEBIkzDn+3YQuN/oOa4V 6d1Hsj8m9OYoCvfxumlLmdUvHJI3rRUb0pJiHkzgcrUWcFWuDF6wwz2bUGTxHU5v27vU Mccd1L7hOuELLnn79lr8P7L/Syzy7yBO4McUhBnFK/ee3pZE3Fbxlx8pLVp53xBFmwa2 o7U4MKErivL3K3d3MA8Tn8ti5pEshz3fPq2QE6RDoAARdBJZDMFw3HNBmN+bi4d2OQpc KBQA== X-Gm-Message-State: ACgBeo2rIY1L3zGR1UiV7abRTDtNxZ5B8xUukkmIRoyBIPnVokt78U4C nV2wzyBXhtFEz0u11irJfMAZ98A+K7ukMw== 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::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@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-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Richard Henderson --- 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;