From nobody Fri Dec 19 15:59:52 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1663873053; cv=none; d=zohomail.com; s=zohoarc; b=NLWEIETnzhTiuVhJHjZBsDGWD06xpdVTy4V4+lXRlvOtuR33S/KxwzXgT0fUfnk4KskC800OnKYtKJ6p0oppCYS4gU+I9+JjIHDMFhiCfuJ+wD/mwFc1vVus+lOLzJKcbGy9zl3z8ipRc8IwRcY4Ewe5WVxNWecxKVg2DBu0h9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663873053; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Iq7GHbEjHTo1LvtpoRoRhaQR0OgzbS3qn4RhqhBWZ9U=; b=nVYdynnT3CNU+x9XMwa1LyhuQMD7Ov2zijT3GQo/IFvHCL8ZO+ztft2stKA/fRmNPH8YmVTZgXkbSiUG9wDyzWBhFqeIaA+6h1LuYYMfzlb4gS7WZx3lXD6TGnmdhXN7fQOchUoXaiui+gzsIksiMPt6ptoQ++HLWsFdvUQXD88= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663873053335514.4415559517388; Thu, 22 Sep 2022 11:57:33 -0700 (PDT) Received: from localhost ([::1]:54996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obRO7-0006PO-76 for importer@patchew.org; Thu, 22 Sep 2022 14:57:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPBG-0002Dd-J6 for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:11 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:39869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obPB8-0005Nu-PL for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:36:02 -0400 Received: by mail-wr1-x431.google.com with SMTP id cc5so16440659wrb.6 for ; Thu, 22 Sep 2022 09:35:54 -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.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:35:53 -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=Iq7GHbEjHTo1LvtpoRoRhaQR0OgzbS3qn4RhqhBWZ9U=; b=w6gCJm0194grWynBYVtJVt/SgDR7NgGKmdUt9BJULpIxFDmW10NFCo+Oxds4k/1c7M EgoqM65Ss2VWt5PP4SeLNgpY2G89p+yNbuZ1QTbO71gvoCP9uz1uFOeIIF3m4B6velyE EKzAy3fkw6ApalH3oZSrkavyD9USFEK632RB2ZqIVpkSgEd0IgGXc+XMlTDCWywy8f+y VK0ctLEKVRGmGuuF9W2WJqc0+nel0K3Gga4s+0peU7t9rRdG0Dn/n1Bcfdrv53ByBrw2 XgkZ9hYdzDp3MC2ee+DppKekf+9mOIVY+lz3F47U3rmJp1M8NiYEv6ibTnYOPkDHGrN5 cO/A== 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=Iq7GHbEjHTo1LvtpoRoRhaQR0OgzbS3qn4RhqhBWZ9U=; b=qcqZHSb7kcyGU5AdCdBISk9TVT2CmdEn0S8cD79E/znhITDiqxMjB+q6K+aZ7RDE9M 0abu6wSLyoj+ZVkyenCN9byLs3LWRL3Ftfi5QxfASq5u/AGZLRNvL4c6hIr8ZLMbLp6e L8o2rRWt3qGZJVRS7YRq4stqbSJZoFSvlQLylX/ul0jSa1QITQCGzJ0tQWxyVnKVrtCJ j472Hl0UlJ2NZIs6ZPwqdzmePEhyWxFEeZ7ojaNl/zyinYLui9M10C55fy4U7arobJQg tCRvHRffGenG/gDirXvwIMR0l9t4ZVTl7hSD8N4NULuAh3iS1VczR0CzaAMA/xg78pfh C4iw== X-Gm-Message-State: ACrzQf34FhTs/Ix8ZqMZ+xofelX4rLnXrxNKSMgdFxDXkZ1r0vAiyoDP QMICAnuK7zYeGwtWNJwAhfCBHgo5eukwqA== X-Google-Smtp-Source: AMsMyM6NoUjfR54+LHFrrL+JRbf8BgpGL2mSFTX7Evq66e9ijv7agr0OHrD6WjcIedZneDrHiI1ddQ== X-Received: by 2002:adf:f2cf:0:b0:22b:e4d:62cc with SMTP id d15-20020adff2cf000000b0022b0e4d62ccmr2586707wrp.27.1663864554244; Thu, 22 Sep 2022 09:35:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/39] chardev/baum: Avoid dynamic stack allocation Date: Thu, 22 Sep 2022 17:35:21 +0100 Message-Id: <20220922163536.1096175-25-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1663873055479100001 From: Philippe Mathieu-Daud=C3=A9 Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Samuel Thibault Signed-off-by: Peter Maydell Message-id: 20220819153931.3147384-4-peter.maydell@linaro.org --- chardev/baum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chardev/baum.c b/chardev/baum.c index 6a210ffd815..0a0d12661a4 100644 --- a/chardev/baum.c +++ b/chardev/baum.c @@ -299,7 +299,8 @@ static void baum_chr_accept_input(struct Chardev *chr) static void baum_write_packet(BaumChardev *baum, const uint8_t *buf, int l= en) { Chardev *chr =3D CHARDEV(baum); - uint8_t io_buf[1 + 2 * len], *cur =3D io_buf; + g_autofree uint8_t *io_buf =3D g_malloc(1 + 2 * len); + uint8_t *cur =3D io_buf; int room; *cur++ =3D ESC; while (len--) --=20 2.25.1