From nobody Sun Nov 24 14:47:43 2024 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=1722332550; cv=none; d=zohomail.com; s=zohoarc; b=QZ020B/OLm+/VYTRvtlvZqZubhVSbWnhv+CeH2lp1nIDQbTZ8oWHK0JkbiqhF32a0932oONkuEhUIDCu1hkt3YW8JKadIdV7BBcX+ijiHTAHII21AG7c7JAikocAAvoq2+lq9Bb1FNnsg5OzfprinIvDuQIjb5Jq1jWWAEGrne8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722332550; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=y9IjY/fhNilZFR1VTqsWrhWqxlwIIF2aeXKAohFdZZ8=; b=RumxSPungMDlBSVGzC8u49fr2K1B9+GTwoM6KLMnDxs0dKjfV332SCh1/6L+wH+nC7xeTtp9y+GM1uYdJziB3j19QhCj+vVxQA7ry92W8ejmCFxExyy5CMkWT+MKQ5lQjj+ww6/Fnks3YdfKr9KFHTvCMo8LtaLJma7TBy19zGk= 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 1722332550804937.364550771417; Tue, 30 Jul 2024 02:42:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYjLT-00049h-0Y; Tue, 30 Jul 2024 05:40:39 -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 1sYjLP-0003vB-GL for qemu-devel@nongnu.org; Tue, 30 Jul 2024 05:40:35 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sYjLN-0000dZ-Ou for qemu-devel@nongnu.org; Tue, 30 Jul 2024 05:40:35 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-36887ca3da2so1923382f8f.2 for ; Tue, 30 Jul 2024 02:40:33 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36862549sm14194974f8f.106.2024.07.30.02.40.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 02:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722332432; x=1722937232; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=y9IjY/fhNilZFR1VTqsWrhWqxlwIIF2aeXKAohFdZZ8=; b=DWnwCkv3JRpt7N6/dYTLrTsCzywUp3qSCHFszcJ+Qvcaf6KNGZE7cil66PUL4dwB3w mGaztCpnqfhCdv90swb0PAJtcvCu8DLPa6+Y4lQGvU5hKeJSyShSsruGss5QsJQ0knIv 5edUihVWhtlgJ31Vyh1iPH+Pp4SWUvp+A3wDhQPfOUgKnp/CidMEY0HmmvV3i4sBVsio IIjsB8uSWv/3trp9Jggm3bBu8oA7zNPSVmGjOekdQTeRIZqMI1le2Cv/ljykVWbK2Mnb egRgiyTMDpjK+CyQReGIL4A1c3HUJGlgJDc8kNlrUj9fCwNFxewzY1N04ynMb83RcnmF abJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722332432; x=1722937232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y9IjY/fhNilZFR1VTqsWrhWqxlwIIF2aeXKAohFdZZ8=; b=aCUQG/xyinJcDP/YZxqXZwyykh1x3BDdUCE0zhippBE0umfMPr2mE2TyjayVfyhhkm w1Ig0kh3VFh4e5wLvxQSQcYqkfEHd9qqecorM2lXGbhVCo8T7pm8LJIG1pD8NzBjrUkn Ui9vn/vBnL2nUvQ13q6mN/Tv7UpWto3VuFj8N9MdzwXI6kI9oypu7Jp96g8pypOfjlp2 /M0ggtpCci9InXkgzHQDXQYM8veaqA9Lf3wsU4yzwvWkkc1m3x4ti5HXdB9VG4ClM2yO VjjDCsmjIf1l0rY/eW6592O3GBjUK9txlEHlphtA93jjqO3s6zsqSpN79YScf1zY+GL0 9F1A== X-Gm-Message-State: AOJu0Yysx+n5yqb82T6a6hla/bhFh+gG+uW69g2asybWf0CLo78p7cEU /iNa+z7bcB3CQ3wZR3EWHIp5lpxx/D1P7MrIQrkhX2g8ntVufB8x/1wF/waDOiIEcxxAxaOj8lp c X-Google-Smtp-Source: AGHT+IEfRmKpL1iptkOfHV8ZKKO7OSHt4+cBUuTeiVC/ds4f8Yv39g9b6NdRnG2fnhkcxlJjdbrFoQ== X-Received: by 2002:a5d:6ac8:0:b0:35f:d70:6193 with SMTP id ffacd0b85a97d-36b5d08b2b8mr6428959f8f.41.1722332432253; Tue, 30 Jul 2024 02:40:32 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/21] target/i386: Remove dead assignment to ss in do_interrupt64() Date: Tue, 30 Jul 2024 10:40:18 +0100 Message-Id: <20240730094020.2758637-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240730094020.2758637-1-peter.maydell@linaro.org> References: <20240730094020.2758637-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::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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: 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: 1722332552781116600 Coverity points out that in do_interrupt64() in the "to inner privilege" codepath we set "ss =3D 0", but because we also set "new_stack =3D 1" there, later in the function we will always override that value of ss with "ss =3D 0 | dpl". Remove the unnecessary initialization of ss, which allows us to reduce the scope of the variable to only where it is used. Borrow a comment from helper_lcall_protected() that explains what "0 | dpl" means here. Resolves: Coverity CID 1527395 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20240723162525.1585743-1-peter.maydell@linaro.org --- target/i386/tcg/seg_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index aac092a356b..bab552cd535 100644 --- a/target/i386/tcg/seg_helper.c +++ b/target/i386/tcg/seg_helper.c @@ -926,7 +926,7 @@ static void do_interrupt64(CPUX86State *env, int intno,= int is_int, target_ulong ptr; int type, dpl, selector, cpl, ist; int has_error_code, new_stack; - uint32_t e1, e2, e3, ss, eflags; + uint32_t e1, e2, e3, eflags; target_ulong old_eip, offset; bool set_rf; StackAccess sa; @@ -1007,7 +1007,6 @@ static void do_interrupt64(CPUX86State *env, int intn= o, int is_int, /* to inner privilege */ new_stack =3D 1; sa.sp =3D get_rsp_from_tss(env, ist !=3D 0 ? ist + 3 : dpl); - ss =3D 0; } else { /* to same privilege */ if (env->eflags & VM_MASK) { @@ -1040,7 +1039,7 @@ static void do_interrupt64(CPUX86State *env, int intn= o, int is_int, env->eflags &=3D ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); =20 if (new_stack) { - ss =3D 0 | dpl; + uint32_t ss =3D 0 | dpl; /* SS =3D NULL selector with RPL =3D new = CPL */ cpu_x86_load_seg_cache(env, R_SS, ss, 0, 0, dpl << DESC_DPL_SHIFT); } env->regs[R_ESP] =3D sa.sp; --=20 2.34.1