From nobody Mon Feb 9 10:33:26 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1768234710; cv=none; d=zohomail.com; s=zohoarc; b=RGADqWbI0w/7g995+5SK1MBiRws+QkTfgAPPGF7FbBOBmfYxGgpi90shuvfIYJOFdbQxoSi2d62DRgQiPZPSenIZU/wxy1dbIXv5zy0Yuetlnlb02a5ADT5KIxuZBAxi45FY8/PmMZOPMr9JMr0oIwYpvCbTgtjj8NOgg/TKuFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768234710; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Gv07gSs/PvTjpMJNrjhTm55jYh8xe0jymb55ySDg85w=; b=iDwpCg0Wq9o11+VhoadBiQxCYdWjKR+EIEvgU+dmZm010fdygkl7lbTiWalgbKJEZCfSgzWARizL6Xwce1J4zgWEhfzHJz45ThIu4n7ki5gUDs3L/q7Hr93h7ajX82XcyYEWTXdsnf6wkYWPUlUN2wOSPpBHWcSVoSE5Tkm3EZQ= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17682347104201021.454099623695; Mon, 12 Jan 2026 08:18:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfKbQ-0000C4-9l; Mon, 12 Jan 2026 11:17:12 -0500 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 1vfKay-0008Up-1K for qemu-devel@nongnu.org; Mon, 12 Jan 2026 11:16:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfKau-00077q-JI for qemu-devel@nongnu.org; Mon, 12 Jan 2026 11:16:43 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-104-iGJ2YI2cOnKwwA_cMfMO-Q-1; Mon, 12 Jan 2026 11:16:35 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F343C180035D; Mon, 12 Jan 2026 16:16:33 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.79]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5924C30001A2; Mon, 12 Jan 2026 16:16:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768234599; 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; bh=Gv07gSs/PvTjpMJNrjhTm55jYh8xe0jymb55ySDg85w=; b=KxZ1HRLJkT4PuYzyUmoNVEhVS745CPmu+DwysYboW2YdT1e7Qqj+KGadlgVlpABZ/q8YF3 GoG+16AVHcYGQ3DUeDn0xOLwgQcz332sRaoI/VYL6l++tfs870fZcU17jLJQlTB8PPLSHt mx4pEe2Q0KOkCMh7JlBA3KzcyVifR44= X-MC-Unique: iGJ2YI2cOnKwwA_cMfMO-Q-1 X-Mimecast-MFC-AGG-ID: iGJ2YI2cOnKwwA_cMfMO-Q_1768234594 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PATCH] target/riscv: Fix build errors Date: Mon, 12 Jan 2026 17:16:26 +0100 Message-ID: <20260112161626.1232639-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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 (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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1768234712168158500 Newer gcc compiler (version 16.0.0 20260103 (Red Hat 16.0.0-0) (GCC)) detects a truncation error: ../target/riscv/cpu.c: In function =E2=80=98riscv_isa_write_fdt=E2=80=99: ../target/riscv/cpu.c:2916:35: error: =E2=80=98%d=E2=80=99 directive outp= ut may be truncated writing between 1 and 11 bytes into a region of size 5 = [-Werror=3Dformat-truncation=3D] 2916 | snprintf(isa_base, maxlen, "rv%di", xlen); | ^~ ../target/riscv/cpu.c:2916:32: note: directive argument in the range [-21= 47483648, 2147483632] 2916 | snprintf(isa_base, maxlen, "rv%di", xlen); | ^~~~~~~ Since the xlen variable represents the register width (32, 64, 128) in the RISC-V base ISA name, mask its value with a 8-bit bitmask to satisfy the size constraints on the snprintf output. Cc: Palmer Dabbelt Cc: Alistair Francis Cc: Weiwei Li Cc: Daniel Henrique Barboza Cc: Liu Zhiwei Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index ffd98e8eed468645b8ceb8a7adb45718bdc4444d..e95eea024939d2cbb5747781c29= 1fed0e1b07bb9 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2913,7 +2913,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, ch= ar *nodename) riscv_isa =3D riscv_isa_string(cpu); qemu_fdt_setprop_string(fdt, nodename, "riscv,isa", riscv_isa); =20 - snprintf(isa_base, maxlen, "rv%di", xlen); + snprintf(isa_base, maxlen, "rv%di", xlen & 0xFF); qemu_fdt_setprop_string(fdt, nodename, "riscv,isa-base", isa_base); =20 isa_extensions =3D riscv_isa_extensions_list(cpu, &count); --=20 2.52.0