From nobody Tue Feb 10 03:40:03 2026 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=1660924362; cv=none; d=zohomail.com; s=zohoarc; b=OdPXOyQaLqVEcpjOavx+W1m+R0zjfTRIjevbqh8ySo28yhl/QsD1UY9sY00IEzeSRMiaRcQcroEl9Nx79UlxYjKvnfGFWuh7QAHjLmCORp6bihzH+WkD5XO8gvJWyLf5jTZNUdGsnSZKH9uVlkiNP3nEQSNEHeedzJhIWdOK3rQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660924362; h=Content-Type:Content-Transfer-Encoding:Cc: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=zDPOe1uObuxexnvyi+yesTMCr3hQR4+1gwfCM4+5LO0=; b=isZhjBYbKBoxhS+A6DYvkMpG6b4gv0mNNC0TGlU86u7J0KBwMZGjSwQZlrJEoIbHPJXvDaWMi2QU3mfQpVEyVF53tmc22dmOx/k0vxTzJoWyARWRrTo0m0WCoTBQG6jh1qNBTl7NLZTloaPwZjQekFJNUiqORWWI5AZROaJHND8= 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 1660924362161179.9948118544752; Fri, 19 Aug 2022 08:52:42 -0700 (PDT) Received: from localhost ([::1]:44032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP4IZ-0000lX-RO for importer@patchew.org; Fri, 19 Aug 2022 11:52:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oP46D-0005le-JE for qemu-devel@nongnu.org; Fri, 19 Aug 2022 11:39:53 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:38699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oP46A-00066e-Jt for qemu-devel@nongnu.org; Fri, 19 Aug 2022 11:39:53 -0400 Received: by mail-wr1-x436.google.com with SMTP id b5so1346653wrr.5 for ; Fri, 19 Aug 2022 08:39:50 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 08:39:48 -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=zDPOe1uObuxexnvyi+yesTMCr3hQR4+1gwfCM4+5LO0=; b=RXQ76h/CA4jXaZNLn4RwOVYu677lB4hoozg2SBc4RHoTFmiTJIej9SSYL6KQ3x0gtK iigSVbLLxoI0WM1jY7zka1QCXUXbirtltrZBy7KhZtINLjbIfccQzXx/D8iSJnaXGnjj yjccdRi7agGWSMhjEhvfxkarVciTFnCVxe2Cgvi5Y6fRFEWq/Nd16H5SOnU+KiGDZKDw EpMnKgb6SAnpfhJ7uoY0pFclRFUNh7HxkAvY8EAS7wdbYDbrbCYjaTtUdpZlHLzyFmHP 94o04J0hrNW9IsI8BrVmIg+ZXRm0drvgBrl8VxM+VBYHf3a06nImVJ3gkvdbJayN6IYg f4xg== 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=zDPOe1uObuxexnvyi+yesTMCr3hQR4+1gwfCM4+5LO0=; b=chv0h1A2Hs/ER5BEdYfs175CkmwAjIjwM7zngwD6C2uBiqrEhDTkLxwoNf/83jCpqw NicDTsDLv2hmZxHF1nmLfFxqtk1sMgPjxHpElmB+rq7MS4nuiOgdCNYWhDpOxFGi8Ada 3b3w+ppk2lMgFgEy56g5AQGpoQFEkhfZz7sEQ+tQ3a/mIJdLXGlPKj5AzIDc2WXxRyAH qgI743ObHr4E2fkWp10Mv2ALfHIynaTDEU+RpQesnFJEHgtgfAGJ8UXI+xk8OlPTANqS rq26dj9mKHfUA65jIjNB799xZ9JZByMXR1u7qYD3lLvkEjGmU1pGlfH6mC+XHzPHyT+u onsA== X-Gm-Message-State: ACgBeo3Cl0tqgcqsN2xTjzj2e0ZZkrAIUp2DqflsTfr75Sq/gYDIwyLe A1/6Z5a0YS0AjlRWSM849bGBj8H7OKJdeA== X-Google-Smtp-Source: AA6agR5A6GZoW3JsZOQPJd9YZK+EiySrV8mTBieN7MIq9baZBH1YjZY0w0pnTUVqmnlPXQpFaFAAtg== X-Received: by 2002:a5d:5711:0:b0:225:2884:cc88 with SMTP id a17-20020a5d5711000000b002252884cc88mr4537239wrv.141.1660923589234; Fri, 19 Aug 2022 08:39:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Daniel Henrique Barboza , David Gibson , Greg Kurz , Dmitry Fleytman , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-ppc@nongnu.org Subject: [PATCH v2 11/11] tests/unit/test-vmstate: Avoid dynamic stack allocation Date: Fri, 19 Aug 2022 16:39:31 +0100 Message-Id: <20220819153931.3147384-12-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 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::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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=unavailable 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: 1660924363044100001 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: Richard Henderson Signed-off-by: Peter Maydell --- tests/unit/test-vmstate.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c index 72077b57800..541bb4f63e3 100644 --- a/tests/unit/test-vmstate.c +++ b/tests/unit/test-vmstate.c @@ -87,17 +87,16 @@ static void save_buffer(const uint8_t *buf, size_t buf_= size) static void compare_vmstate(const uint8_t *wire, size_t size) { QEMUFile *f =3D open_test_file(false); - uint8_t result[size]; + g_autofree uint8_t *result =3D g_malloc(size); =20 /* read back as binary */ =20 - g_assert_cmpint(qemu_get_buffer(f, result, sizeof(result)), =3D=3D, - sizeof(result)); + g_assert_cmpint(qemu_get_buffer(f, result, size), =3D=3D, size); g_assert(!qemu_file_get_error(f)); =20 /* Compare that what is on the file is the same that what we expected to be there */ - SUCCESS(memcmp(result, wire, sizeof(result))); + SUCCESS(memcmp(result, wire, size)); =20 /* Must reach EOF */ qemu_get_byte(f); --=20 2.25.1