From nobody Wed Apr 8 04:42:29 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=1773156873; cv=none; d=zohomail.com; s=zohoarc; b=mI1UJWWXBIjn8bLLAYS0i+JitOauCdTx5SqzhRA3p0IoR9eBW2UzNDYbj2N0Ubzu1RAq3Fw5+ocYca+5A6FnSTuhkk+17fH6zgL49kvJrXP6teG6gVaPervEuraiTM8qs1rEhRk6CNwV6Hyq2jKbjbhx3qKhV3GL4g8vFAlJ02M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773156873; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=phyKVf8+i/f8H3jvXeFmhE7LF3Q9UMc/WnROb/AlnvU=; b=imubw/qPab1+I0ByBBaRB5W9sPya7Sn2cj0ktjTJYO4ka7ZDn8L2J+O+g4CR35v8QAP5q3wnCL7iYxkXhzMjrTJapIn1YAkOjYMXhkFrQ/kz+uKr5gD3BMSX2SRwkt1b3vt8I3NtOq1GiVZhf5SM+jW4CXtf2IrkE/op1SV3/aY= 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 1773156873373506.10190416049306; Tue, 10 Mar 2026 08:34:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vzz5r-0002s6-34; Tue, 10 Mar 2026 11:33:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vzz5g-0002qn-4s for qemu-devel@nongnu.org; Tue, 10 Mar 2026 11:33:48 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vzz5a-0007rV-Bt for qemu-devel@nongnu.org; Tue, 10 Mar 2026 11:33:45 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-439b2965d4bso7700669f8f.2 for ; Tue, 10 Mar 2026 08:33:41 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439dae45786sm41709388f8f.32.2026.03.10.08.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 08:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1773156820; x=1773761620; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=phyKVf8+i/f8H3jvXeFmhE7LF3Q9UMc/WnROb/AlnvU=; b=VHFukDTYvgQifa5JNQVGn4XcO3r/CBxqZqQOG3t3FNnY0lNDtyU9OlCWTvo5kErZg9 fux9IzMNe5QovtYxV4lKjL5J3G2JJUA9jqdaWvMPwN8TKbFs0NBAd86SWusuOqCluVzU fMUSXKcigUDHxV77tRVxMg4tg5I8N8UN+d1vczaWUk6jV+svfogE2IlrVBdhLRlZP393 ofXhlEunLfZeVvJZYlv/AZ/hK063NgRKHPgMesIdgsFdpGclRNPTINP0zipO5ibS8duc 79iM4upuWMISY7MJ1GyoLyzgheUI17btfilHi+lo26TC3I/AyYZaYJvEy4sexEJTUfTw cRWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773156820; x=1773761620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=phyKVf8+i/f8H3jvXeFmhE7LF3Q9UMc/WnROb/AlnvU=; b=spywgkAlBgOrnT+ibt0xQCoz/z9IwSOtKBgQcTFjwOWlqfnXwm4uP4NOwy2+V2qFSb vc2DYM/otOa+apq//wy7nUSidodsZNOV4wMOPr1paFcUGzLQnntNh/VQiuvFj8mpAxye x+iLpd5YGhKc4epXQsQSi8/LYDrVA7OBVY9xA/Fm9vu4WmsFOx9JPPXdYWcTCP57h2tD 6t6MhyECNOixwoWCTZAxDv2JtDuxZXu6HyQInUfuqelmXx2ke3Tt+r6Y3uZmrznSwgVt MLcpStxF4EnhI7+FUN/rMR/xxEyYVNJ8qNGBZJlk7is+n2rVt4IYEw1HsO9lNG2d9itl etcg== X-Forwarded-Encrypted: i=1; AJvYcCUy0AWYOBpM+ruddYj6WCHPJ7gBCegmzemzf6NlvI0T1hW8wSO0zpHaJ2TnnetkY0pldu5t5jpy6Gn6@nongnu.org X-Gm-Message-State: AOJu0YxzG2l+u5T01YYy1iUweM/WjoDOmvLASnFuVVLosboLlAyZZOsu 0ozpByQhTbjyNxiFxj5TknCU7Nu+OkMsuYtWvQhCrp7R2JUT970TJGQ9aAMKIOQ7qJc= X-Gm-Gg: ATEYQzyZCrEFcIf2Ou1P+Wf4cIgqbuTLW+d0xRllnZdSo+nPKjCbtgb2UvJEAEls23w aNz6/UTUXtMG8UXOQE3dAmWE1TH8szpM+dGpZZf6XQe4d4N3z0qjc7C2M+FRjaeXNZCBsTYaYWx HOY3wmaObIewebScGq37earT9aOz6+eYaJc6NrSNQEER57Ar3t8O5TAZmx7T+RhH59EqbMBuQaB FVqS+RE56SVNAPZjjyC1MBjaIXFmZ6EHb5eAa03DK4+ykTM6JYiQbUCbUS/0C12WsOae7hAdRRM EWJ1Z9SVJtStrV7L6JQklqO2Gezj2IgmnAMfJR8LuOKI8m6VbDK1U/mxwfSAt+jFmokv9IWrPhC vkYA+b5xrAhRFq2O9pelnwj1KILeDffqjj3pnAZCB2CHIi5yPN36F4GtcQ3lOhvRMUem5163DN+ PP0K6AS/8IoMZ2XjCYMZslvlZsbi2GHzcnoh8x1d/x35/GECyRiQmoSTTsieN8o8V4KmVxXB8gD BomIgbXy3/HX6PffHkAL6SAp4Bm80++DeisFEosmw== X-Received: by 2002:a5d:5d06:0:b0:439:b8e5:5c36 with SMTP id ffacd0b85a97d-439da35ca0emr27292959f8f.24.1773156819959; Tue, 10 Mar 2026 08:33:39 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Fabiano Rosas , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Steven Lee , Troy Lee , Jamin Lin , Andrew Jeffery , Joel Stanley Subject: [PATCH 1/2] tests/qtest/ast2700-gpio-test: Use g_strdup_printf() instead of char arrays Date: Tue, 10 Mar 2026 15:33:33 +0000 Message-ID: <20260310153334.3063224-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260310153334.3063224-1-peter.maydell@linaro.org> References: <20260310153334.3063224-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::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1773156875900158500 Older versions of gcc with -Wformat-overflow=3D2 don't like the usage of fixed size char arrays in this test; gcc 7.5.0 (SUSE Linux) says: ../tests/qtest/ast2700-gpio-test.c: In function =E2=80=98test_input_pins=E2= =80=99: ../tests/qtest/ast2700-gpio-test.c:54:36: error: =E2=80=98sprintf=E2=80=99 = may write a terminating nul past the end of the destination [-Werror=3Dform= at-overflow=3D] sprintf(name, "gpio%c%d", c, i); ^ ../tests/qtest/ast2700-gpio-test.c:54:13: note: =E2=80=98sprintf=E2=80=99 o= utput between 7 and 17 bytes into a destination of size 16 sprintf(name, "gpio%c%d", c, i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This can't actually happen because of the limited size of the values being substituted in. However rather than require readers to check whether the arrays really have been declared large enough, we prefer to use g_strdup_printf() for this kind of string work. Reported-by: Fabiano Rosas Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/ast2700-gpio-test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qtest/ast2700-gpio-test.c b/tests/qtest/ast2700-gpio-tes= t.c index eeae9bf11f..533feea7da 100644 --- a/tests/qtest/ast2700-gpio-test.c +++ b/tests/qtest/ast2700-gpio-test.c @@ -44,14 +44,13 @@ static void test_output_pins(const char *machine, const= uint32_t base) static void test_input_pins(const char *machine, const uint32_t base) { QTestState *s =3D qtest_init(machine); - char name[16]; uint32_t offset =3D 0; uint32_t value =3D 0; uint32_t pin =3D 0; =20 for (char c =3D 'A'; c <=3D 'D'; c++) { for (int i =3D 0; i < 8; i++) { - sprintf(name, "gpio%c%d", c, i); + g_autofree const char *name =3D g_strdup_printf("gpio%c%d", c,= i); offset =3D base + (pin * 4); /* input direction */ qtest_writel(s, offset, 0); --=20 2.43.0