From nobody Mon Feb 9 22:24:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620249070; cv=none; d=zohomail.com; s=zohoarc; b=UYGxNOYVfhsO9qzzGgn2+2+UAa0Hggcw1xiPAF9bq96Wmhhas+zaoRzp/ROzUKn/vklKofm67wUrHY4cB3U3zL+sNdNe5f+acHauTmSyDzVafUPEVpQ28Z/feu9t1CHr/I+SlKat95kr5jz5SB5Hbju8Eo20jQuXAFI5+v05OrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620249070; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=jDbW5AjqVLLqIRW+qjBQwi317+pzRCZswt2T1a+tgz4=; b=R87+epvD6sjbmdUJHeLnxdHXszH2Y1fDCnv5TZc0pSiGDuzjx5UDUXxZd1r8fERkgRSEx8IGKjdqZU3MccN5oAKWO0DOXtrUWAonUY8t45aWSYVKLhVMadRznNwnJRRCSHykDifPrCXj6+R0AwfmJNKvKmrzp5fAfMtNspxzrLk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1620249070560538.3853345795826; Wed, 5 May 2021 14:11:10 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-2fwpHHRUMHm1UfdoDNVrjA-1; Wed, 05 May 2021 17:11:05 -0400 Received: by mail-wm1-f69.google.com with SMTP id x7-20020a7bc2070000b0290149dcabfd85so703372wmi.8 for ; Wed, 05 May 2021 14:11:05 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (astrasbourg-653-1-188-220.w90-13.abo.wanadoo.fr. [90.13.127.220]) by smtp.gmail.com with ESMTPSA id o1sm4073966wmc.6.2021.05.05.14.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 14:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620249069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jDbW5AjqVLLqIRW+qjBQwi317+pzRCZswt2T1a+tgz4=; b=HHmtU2ZMVnl8xumoNKZBbUuggR/iI5V5rlVZkmHrelW6e+VlshMH2o1oYQrBpXvw+MtAEe Dsf+PzmfZeO48B6Aud5mCM0niRhpU3G3QER2ZHSnuH3TCn/OcgIW+P8V2x9pBu47/OVKrB MWHdpt34IjFbjPePB/lHYMTS6bQ9AsU= X-MC-Unique: 2fwpHHRUMHm1UfdoDNVrjA-1 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:mime-version:content-transfer-encoding; bh=jDbW5AjqVLLqIRW+qjBQwi317+pzRCZswt2T1a+tgz4=; b=X+aukdv7V1F5pMR6XhnMQLXdtKbXrDA+e7tsvo3bt9rMcUb0zGNNeZL0tSUzqHofBP W/FxG3BukcsYokGGWKfgplfvtFXupIztFPplddJw85yoPpG/E1ffzrwdfkLlfFopVt8g cfe6nM3lRONnbROjHR7iQ1uMd2R4f17lS90uRuZiWTUSQZRQdSCtbAhMUzVOKqSRTsRX 7OrbEcK+dV0IsY6aodXHDpICYxc1HKnKXeOierxo0ttmLN6JErAgIkngPljBibKvx7Zy FG9nQa9CvNXSHigEVDFsy7ca2+30XPwgpQS1TRaXIqo/VkATynRP1qjs17VO3jmG8T9/ YPqg== X-Gm-Message-State: AOAM5320UOvKA8etgkOXAis+jF4P3wA3vZCBD8dYqNcVXqjfq92n0FlP NnjoYG6DhUISQu2uvN2aTsFctxOneR/9YK+vObpeB92k3JLhyzgUlnscQYINFv0yqBTCPxq+vu8 xFuHFb42uFiyk2A== X-Received: by 2002:a1c:750b:: with SMTP id o11mr12022971wmc.188.1620249064704; Wed, 05 May 2021 14:11:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOEPOao+qykKQIphPjsuJSYjxkn/EPllDV0Z2ZMqGBHfz+R9Qb+afafsKtq+M5cPi7UKuSqg== X-Received: by 2002:a1c:750b:: with SMTP id o11mr12022964wmc.188.1620249064582; Wed, 05 May 2021 14:11:04 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-ppc@nongnu.org, Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Samuel Thibault Subject: [PATCH 03/23] chardev/baum: Use definitions to avoid dynamic stack allocation Date: Wed, 5 May 2021 23:10:27 +0200 Message-Id: <20210505211047.1496765-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505211047.1496765-1-philmd@redhat.com> References: <20210505211047.1496765-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We know 'x * y' will be at most 'X_MAX * Y_MAX' (which is not a big value, it is actually 84). Instead of having the compiler use variable-length array, declare an array able to hold the maximum 'x * y'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Samuel Thibault --- chardev/baum.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chardev/baum.c b/chardev/baum.c index adc3d7b3b56..0822e9ed5f3 100644 --- a/chardev/baum.c +++ b/chardev/baum.c @@ -383,9 +383,9 @@ static int baum_eat_packet(BaumChardev *baum, const uin= t8_t *buf, int len) switch (req) { case BAUM_REQ_DisplayData: { - uint8_t cells[baum->x * baum->y], c; - uint8_t text[baum->x * baum->y]; - uint8_t zero[baum->x * baum->y]; + uint8_t cells[X_MAX * Y_MAX], c; + uint8_t text[X_MAX * Y_MAX]; + uint8_t zero[X_MAX * Y_MAX]; int cursor =3D BRLAPI_CURSOR_OFF; int i; =20 @@ -408,7 +408,7 @@ static int baum_eat_packet(BaumChardev *baum, const uin= t8_t *buf, int len) } timer_del(baum->cellCount_timer); =20 - memset(zero, 0, sizeof(zero)); + memset(zero, 0, baum->x * baum->y); =20 brlapi_writeArguments_t wa =3D { .displayNumber =3D BRLAPI_DISPLAY_DEFAULT, --=20 2.26.3