From patchwork Thu Oct 20 11:37:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Gross X-Patchwork-Id: 6165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp58242wrr; Thu, 20 Oct 2022 04:46:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LXCozsL7RDMq/SIyOI9yfv/kIOO8kP+sdHfCrO4tjAX50dHgrATTWi7FaXIWAwAi4TNAC X-Received: by 2002:a17:906:7308:b0:78e:191e:8389 with SMTP id di8-20020a170906730800b0078e191e8389mr10451122ejc.170.1666266399416; Thu, 20 Oct 2022 04:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666266399; cv=none; d=google.com; s=arc-20160816; b=F5d86G14tLWlH/uQeleaUOYpHQukOYAuyZCguNELCWRLcy2q6ZbqShLn1L+OrG6U7b ylt0J6PXghFKZspl3Al82VvuOUaDRrnwAbZnXeV+Yjsby7QAMgVNPkbTHR5KwnolIbCh iDNHEOZFwNmNB6pIHX0bO1xm49oO9eyhZFy/IPhwJKeim9JoXKegQSTzWrwPvPGMD26S J3mMhLp4ZCcUzHTlVmjqGPvlBU2q6VXrBzEa2WGT8gCyTopytOD7jvThyfam97Um9OJg Epj0REe7Pa7g1zyTveAsDnaDN4Y9DTvT6bu373NFBhOYcHhoOcPkNKfXOQTYR3L5V+U+ oiyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bOeIQs06Ph1bJ91eHAC9fBVgauw5j59B8/KvO9VWdAY=; b=U6RjxuiOq05Kvy3ky3InkVyXPvu3RFBPipcyIhE+RUcNXqjFMcArwTlkh3rlHw04Y/ L1anLTgJKDFm8Xzhejt6mR0RSlDx+IXYlGevYGiEhJKjzr1Tmdm1GVABu0+4WoJvfxG+ zx+iqFJt/r4FMu+Ba8PUeX0uJvJthLE5TfazNhTIQj/VjY/vyeeTp1zO1PLHLJYS50sw So+9yiTTIdlWWxRYuWc3pAzWqGJAi0sX6WSBZLBulH1QLJU5MQ7wxn05/db3RNhtZVG9 V02mdyJfHrc2gLUqyPoAcZe5jr7tClIzyBN1nBD3cKZophGX78fzzrZYJIPCS7KNcytN XnJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=PBpvCe+e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js22-20020a17090797d600b0078dcfe6a000si19102501ejc.727.2022.10.20.04.46.13; Thu, 20 Oct 2022 04:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=PBpvCe+e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231425AbiJTLig (ORCPT + 99 others); Thu, 20 Oct 2022 07:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231407AbiJTLia (ORCPT ); Thu, 20 Oct 2022 07:38:30 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C9D1DEC01 for ; Thu, 20 Oct 2022 04:38:03 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 92DE21FCFA; Thu, 20 Oct 2022 11:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666265881; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bOeIQs06Ph1bJ91eHAC9fBVgauw5j59B8/KvO9VWdAY=; b=PBpvCe+eKaNf8bwyjdesNestAeyQ6jmQl9dMvpuhLdQXjqPFo9p9VBZgDru/8YYuiEsJmQ M0a4vZAgkjF5JxMl8e5xw+lL3Gdm19fY3NtK8sbry4qXU0+EZFADAIQWui+2pHnFqOrQMh DHvIn+IF35Oa8nHjrGVNSMG5sLUEBEI= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4090D13494; Thu, 20 Oct 2022 11:38:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id REBlDhkzUWPEBgAAMHmgww (envelope-from ); Thu, 20 Oct 2022 11:38:01 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , xen-devel@lists.xenproject.org, Dan Carpenter Subject: [PATCH] x86/xen: silence smatch warning in pmu_msr_chk_emulated() Date: Thu, 20 Oct 2022 13:37:59 +0200 Message-Id: <20221020113759.17402-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747206956324668288?= X-GMAIL-MSGID: =?utf-8?q?1747206956324668288?= Commit 8714f7bcd3c2 ("xen/pv: add fault recovery control to pmu msr accesses") introduced code resulting in a warning issued by the smatch static checker, claiming to use an uninitialized variable. This is a false positive, but work around the warning nevertheless. Fixes: 8714f7bcd3c2 ("xen/pv: add fault recovery control to pmu msr accesses") Reported-by: Dan Carpenter Signed-off-by: Juergen Gross --- arch/x86/xen/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c index 68aff1382872..898a252ed6f1 100644 --- a/arch/x86/xen/pmu.c +++ b/arch/x86/xen/pmu.c @@ -302,7 +302,7 @@ static bool xen_amd_pmu_emulate(unsigned int msr, u64 *val, bool is_read) static bool pmu_msr_chk_emulated(unsigned int msr, uint64_t *val, bool is_read, bool *emul) { - int type, index; + int type = 0, index = 0; if (is_amd_pmu_msr(msr)) *emul = xen_amd_pmu_emulate(msr, val, is_read);