From patchwork Thu Sep 22 16:35:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 608239 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp487946pvb; Thu, 22 Sep 2022 10:58:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6H1uWI8PoVWmye6xSZjvZZ3JPytm/CtC1KDVuXvbVV86BWCS5GEpS+7BDNKVTayXwee7nv X-Received: by 2002:a05:6214:1d28:b0:4ad:6a63:b2c8 with SMTP id f8-20020a0562141d2800b004ad6a63b2c8mr3607583qvd.113.1663869485846; Thu, 22 Sep 2022 10:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663869485; cv=none; d=google.com; s=arc-20160816; b=pvW4HjPHwLnS+qslgPWuKmXfnyMcJuN2KTI1gGWC1IeM2crHLCbP7yGlBJVrHB6Cgm xIf2HLqNDM9pdcs6KI7KfRRvf40WnOMBcuejrKz/LBp9YhhQN/CvdhmK8fE04pPZEeVW yOb7wpcD633MPTAgyCHQAQj9erotUE5a+byKzuH87inXygOQLAhNs/3BT2VNVVqLzcpk ijUIwi+a9IRlv+y0TjQ+5WgAues1nna/S3lpCKaoqHAVbB941MdXP7GiRveleis/auIj Z8ETx5OqG5wmYq+6JiId+ftr0NKdcVRlw7/aAlzdKdHVFGjofR7AW5VWs3K9DvagjWbK 2SjQ== 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:to:from :dkim-signature; bh=325OKYY2nX8aI0G82FZc2RGAVSyYsN8rb3hEEYonRaA=; b=pUnaPsOnwxc/l5UBjyqHpmC44cJuLDaK8atw4b7VGKanfT4Rph9+VIekMrsImZERtS MIJC5tddeiwoi0OSQt6Vj3CXFe219558izjFuyiaNvKDqymffJfZfL6GWHxZF1nKu2Dv pmGg0rXwd98IqHUXl8pbVZcYtK6EvUMkPorAdstlSTQQlTNP/z1goHmLkW+5NbfSUoNG eqizaWRijOUQJU4mn4vpQchtz13AJT6OPqlzXQYX4Qjcc/z3qG3VNJhZfcm0y2tnyy+K lS05sCPKupT2TYfjA/YytpuCA3oSM/Nv/Eq6gMpDL7gvEQlmk7DOOBjh0DOgDKUCE8WH 2WPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qTPOOld9; 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 69-20020a370c48000000b006bacc0fcf15si3043683qkm.596.2022.09.22.10.58.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Sep 2022 10:58:05 -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=qTPOOld9; 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]:59788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obQSb-0005WU-D3 for patch@linaro.org; Thu, 22 Sep 2022 13:58:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPBC-0002CN-7B for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:10 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:39871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obPB8-0005S5-Ne for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:01 -0400 Received: by mail-wr1-x42f.google.com with SMTP id cc5so16440835wrb.6 for ; Thu, 22 Sep 2022 09:35:57 -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:to:from:from:to:cc:subject:date; bh=325OKYY2nX8aI0G82FZc2RGAVSyYsN8rb3hEEYonRaA=; b=qTPOOld9YRvyrbeOp0FEA/UKgHmBt3i5wjTdpWupIXHKxxRHgyr188pcsSx48U9jRo VuWhWa6Cggzx+B0HoZiYAjDD0cHs+Zz6wx1M5KTMWiA98KB/0I4hK1NXptB6kXsY8N7L Y6FheLy9UiFL56CuUfDNuQsRdpydlQ/j4Qj0pMnHyK1DS2WX0qRe/PZU6Pa7XYIEjU3R wv9o/UrnaczpWKxVLM5nTZv46+z6zz/ZFPVU2WD9ybHmEwyWjC8aCUyRZcvtAyHUHIHJ I267nmpYG7Yx8Chl0ySNHgjEoH3ZX+gpuxS9yug9aAiuUmeiNSxi3bHvEjQHfpLkbRc2 HrEQ== 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:to:from:x-gm-message-state:from:to:cc :subject:date; bh=325OKYY2nX8aI0G82FZc2RGAVSyYsN8rb3hEEYonRaA=; b=s78h5LWlYDzUnhDg+wW+4hjSCBBkweSimJ+OqaOh1L8ET1xENf/IF+6+H0xx0wLBWH 4V8XqG2rxxipTNqBYCazkmRLJoJEd8dtG4dxnzJv4sSwkEGrIwmg3daP6mwR0Emta+zo P++QjimuQcpJt5vK5g/FJizh4Tu5toun5t2+MbYneIDmo9ItPxFnBYr126iduT/5cYGV E6/lvbUK+1I0S5+LZGR2tl2z8Ex0/3rPNt1Tl8e6zB3cER28SLttg5Jh9bJ9Pz8YBjW0 EEjngwb+jGIeL8VEGwyAwlCCPxFI7/mqCzoIZE99PItbQNosL4bdD92711scU3nQzkTb 5q1g== X-Gm-Message-State: ACrzQf2pAb+Vw1KjF1dVp5V5YWhoAhyHSV3Ol0zEkAXLzLUe79wYMv5r eGHvkrhdsTaLswx1GScXybWYViOg4kekyg== X-Received: by 2002:a5d:598c:0:b0:22b:100f:c2e0 with SMTP id n12-20020a5d598c000000b0022b100fc2e0mr2588405wri.702.1663864556665; Thu, 22 Sep 2022 09:35:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id iw1-20020a05600c54c100b003b3401f1e24sm6452599wmb.28.2022.09.22.09.35.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:35:56 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/39] hw/intc/xics: Avoid dynamic stack allocation Date: Thu, 22 Sep 2022 17:35:25 +0100 Message-Id: <20220922163536.1096175-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922163536.1096175-1-peter.maydell@linaro.org> References: <20220922163536.1096175-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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 autolearn=ham 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 Message-id: 20220819153931.3147384-8-peter.maydell@linaro.org --- 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;