mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	xen-devel@lists.xenproject.org,
	Dan Carpenter <dan.carpenter@oracle.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH] x86/xen: silence smatch warning in pmu_msr_chk_emulated()
Date: Thu, 20 Oct 2022 15:34:58 +0200	[thread overview]
Message-ID: <26bae6db-0e17-2b54-4046-0e85b26f6401@suse.com> (raw)
In-Reply-To: <47668d94-6b55-2894-fa6d-82b1f17312bf@suse.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 918 bytes --]

On 20.10.22 15:16, Jan Beulich wrote:
> On 20.10.2022 13:37, Juergen Gross wrote:
>> 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.
> 
> The risk of introducing a problem might be quite low here, but in general
> it exists: With the adjustment you remove any chance of the compiler
> spotting a missing initialization before use. And I'm not convinced using
> 0 in such a case would actually be ending up sufficiently benign.

Hmm, an alternative would be to initialize it to -1 and add a test for the
index to be >= 0 before using it.

Or to live with the smash warning with the chance, that a compiler might be
warning for the same reason in the future.


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2022-10-20 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 11:37 Juergen Gross
2022-10-20 13:16 ` Jan Beulich
2022-10-20 13:34   ` Juergen Gross [this message]
2022-10-20 14:22     ` Boris Ostrovsky
2022-10-20 14:33       ` Juergen Gross
2022-10-21  6:46       ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26bae6db-0e17-2b54-4046-0e85b26f6401@suse.com \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=dan.carpenter@oracle.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jbeulich@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®