From nobody Tue Apr 7 21:27:35 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 ARC-Seal: i=1; a=rsa-sha256; t=1773258097; cv=none; d=zohomail.com; s=zohoarc; b=Uld493MpgvplXsKTFfk+Z4GTrHOWJXeh34Km1j0zoSp114oHtKqUnTAxUhHRNgiqq+2Bz7isbPofwPSjsj5K82x9GqE7LQcnqwqMfXiVf2A7ltixjH2dnAgpxX9bU3rnz8R71JQV6u5Xg2bpbYthRW5SojLEUBBcuf+3rbzz+Jc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773258097; h=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=I4j31yu+w7QzgHSLeJKqRxEGYUKJxec5ah9EQQR9CYs=; b=oL1JgnSIYjIKEflqP/MiFQqfIXFyM4+Vb1sry40PNaQMyQYN4a3oKvkAC+0cx9glTMKfO3O34j32TKtYkth4h/p2ncShPH/VlpKd9y8H6HRalXkTy4ZZ2mPWDuLyydzTSHWkDT3EAhjBH1aupaUp688s/sTYWzCKVzdY2JBhfS8= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773258097302495.78511209701026; Wed, 11 Mar 2026 12:41:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0PMt-0002mk-Dy; Wed, 11 Mar 2026 15:37:19 -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 1w0PMc-00024O-79; Wed, 11 Mar 2026 15:37:05 -0400 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0PMa-0000Mw-Ek; Wed, 11 Mar 2026 15:37:01 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 501E0192103; Wed, 11 Mar 2026 22:34:28 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id 8DB4537C468; Wed, 11 Mar 2026 22:35:06 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tls.msk.ru; s=202602; t=1773257668; bh=ncRKvUmfHxk2xo7lLCqZMz7B/sef0n2UxIPoKz/bu38=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aYwNBBJvGVyQioAuAwDQVTAL8iMyFZxwruQOYx0UsgPQYskO2Mt/8Vp55GxkhPgFj lbQgVd63HHAqjYIDDRGOFqHUJZcO6XUV+AGvkn8PCy9HezOUylXr/MQmzk/0PkbHEO Z2uv9238IV7vf4p41zR1vVKSW+OtJgb9KRlHVKw7R8vkpUnOAbYUOZIsOBfG9CqH+A YlmyRIJrVYYmi6WyUBe/8CztHJwcO7Mf0FuWt8plgc7fAq2+iTq3ybkw/ZUDHujjYB XGqMR4O2GsEWXT3j+SrRhdwnWX2KgCKIeFgSyaA2ekQ/HQjBh4lAzLqJZQqAl4PgZb sKXruPXPHTPbQ== From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Bernhard Beschow , Mohamed Mediouni , "Wei Liu (Microsoft)" , Paolo Bonzini , Michael Tokarev Subject: [Stable-10.2.2 27/53] target/i386/emulate/x86_decode: Fix compiler warning Date: Wed, 11 Mar 2026 22:34:20 +0300 Message-ID: <20260311193449.1096110-27-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: MIME-Version: 1.0 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=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 @tls.msk.ru) X-ZM-MESSAGEID: 1773258100089158500 Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow When compiling for i386-softmmu under MSYS2, GCC emits the following warnin= g: In function 'get_reg_val', inlined from 'calc_modrm_operand64' at ../src/target/i386/emulate/x86= _decode.c:1796:15: ../src/target/i386/emulate/x86_decode.c:1703:5: error: 'memcpy' forming o= ffset [4, 7] is out of the bounds [0, 4] of object 'val' with type 'target_= ulong' {aka 'unsigned int'} [-Werror=3Darray-bounds=3D] 1703 | memcpy(&val, | ^~~~~~~~~~~~ 1704 | get_reg_ref(env, reg, rex_present, is_extended, size), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1705 | size); | ~~~~~ ../src/target/i386/emulate/x86_decode.c: In function 'calc_modrm_operand6= 4': ../src/target/i386/emulate/x86_decode.c:1702:18: note: 'val' declared here 1702 | target_ulong val =3D 0; | ^~~ In the calc_modrm_operand64() case the compiler sees size =3D=3D 8 to be me= m-copied to a target_ulong variable which is only 4 bytes wide in case of i386-softm= mu. Note that when size !=3D 1, get_reg_ref() always returns a pointer to an 8 = byte register, regardless of the target_ulong size. Fix the compiler warning by always providing 8 bytes of storage by means of uint64_t. Fixes: 77a2dba45cc9 ("target/i386/emulate: stop overloading decode->op[N].p= tr") cc: qemu-stable Signed-off-by: Bernhard Beschow Reviewed-by: Mohamed Mediouni Reviewed-by: Wei Liu (Microsoft) Link: https://lore.kernel.org/r/20260223233950.96076-2-mohamed@unpredictabl= e.fr Signed-off-by: Paolo Bonzini (cherry picked from commit c86bca1671e9e4161e2a93d73514384de510bbf3) Signed-off-by: Michael Tokarev diff --git a/target/i386/emulate/x86_decode.c b/target/i386/emulate/x86_dec= ode.c index d037ed1142..6ad03b71b0 100644 --- a/target/i386/emulate/x86_decode.c +++ b/target/i386/emulate/x86_decode.c @@ -1699,7 +1699,7 @@ void *get_reg_ref(CPUX86State *env, int reg, int rex_= present, target_ulong get_reg_val(CPUX86State *env, int reg, int rex_present, int is_extended, int size) { - target_ulong val =3D 0; + uint64_t val =3D 0; memcpy(&val, get_reg_ref(env, reg, rex_present, is_extended, size), size); --=20 2.47.3