From nobody Tue Apr 7 21:55: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 ARC-Seal: i=1; a=rsa-sha256; t=1773242824; cv=none; d=zohomail.com; s=zohoarc; b=YpXuy2qYqzeguQpXc4PoH+qhT+GRNy5rl5dRaGtbB1hPITlfPWgz0r5vnu2RKZWAUUwgfDddGpANaCjkpA9z3zlvzYy/2RaT36DPBTu7Lm8Kudi60JHlKOU9RfiQwSQ4Sm9NqqCvA+waLhPzOq8zqU3FAiuYQmnssThA7qgWe40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773242824; 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=s4aN9PDhrR+3byRl/fQzmOrBbw+PLIlJFR2oUBeHxlc=; b=Xomb6CgAxjYRW+cdqn4OQJtzzjAV9CD4HEpxGNKkYpVBfAFqF7yPpjAozTyAEvUirm8WN1SECvH0YTgM41SLUxdr3RLMGyv7e4yFj9nNk1187N2aSaEsx3J49HxJiurtHDEQznK2Ejt4jgwC2zEflFaxXXGTfzS0dFTLmYRHxkY= 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 1773242824951584.9280449707957; Wed, 11 Mar 2026 08:27:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0LDp-0004OB-1w; Wed, 11 Mar 2026 11:11:41 -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 1w0LBL-00080B-S4; Wed, 11 Mar 2026 11:09:07 -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 1w0LBJ-0005gJ-TQ; Wed, 11 Mar 2026 11:09:07 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id D738E191E9D; Wed, 11 Mar 2026 18:04:42 +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 C327E37C2DE; Wed, 11 Mar 2026 18:05:20 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tls.msk.ru; s=202602; t=1773241482; bh=1HjWwuWMbJ/lQLP8MJ0zy8gCLPzqeUaEQHlIXn44DXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bdpZk7nedMhY7yGQyqTJufDTwNmWE5Q3v6B4P92aKPqSE9WL3GOIGZ8R8yjnr4x/T OWN78TSQPnIM7Vci0M77KewqnAaULf7J6S6n/ZMv93F3H4sxmJXrthd8TALJ0yDAbb Fzz9sTJrlVrI+foHeyWs0WL8ZrLzSFcQ0VtTHpBgmJrCsaFNumJTTa7Q7uobZwr4k+ PKm8sNWc++31HdNRrmyF+JAmHfCWLG9jK3Lrxwvr3umI9giDI7SsTKzSP/15Zii1S8 cI2X6npdwCy3cxi93wDZbLenDLSFDsOyx0qP4CRfGGom20KdSHri28H/x3lOYJCWGX x23iMIqzd3f7A== 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.1.5 26/46] target/i386/emulate/x86_decode: Fix compiler warning Date: Wed, 11 Mar 2026 18:03:02 +0300 Message-ID: <20260311150327.1084669-26-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: 1773242826255158500 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 2eca39802e..aa14d42c8f 100644 --- a/target/i386/emulate/x86_decode.c +++ b/target/i386/emulate/x86_decode.c @@ -1689,7 +1689,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