public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Gleb Natapov <gleb@kernel.org>, KVM list <kvm@vger.kernel.org>
Subject: Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window
Date: Tue, 1 Sep 2015 13:45:56 +0800	[thread overview]
Message-ID: <55E53B94.3060407@linux.intel.com> (raw)
In-Reply-To: <CA+55aFwddHp40vMAeLgXZsKLyxexnzD67dRAW7GtQTOVRvYKug@mail.gmail.com>


Linus, I am sorry for the annoyance.

On 09/01/2015 08:47 AM, Linus Torvalds wrote:
> Hmm:
>
> On Fri, Aug 14, 2015 at 4:57 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> Xiao Guangrong (9):
>>        KVM: MMU: fully check zero bits for sptes
>
> The above commit causes an annoying new compiler warning.
>
> The warning is bogus ("variable 'leaf' possibly uninitialized"),
> because the use of the variable is protected by the 'bool reserved'
> flag, but gcc is apparently not smart enough to understand that.
>
> Since bogus warnings cause people to possibly ignore the *real*
> warnings, this should be fixed. Maybe the code should get rid of that
> 'reserved' flag, and instead initialize "leaf" to zero, and use that
> as the flag instead (since zero isn't a valid level)? That would
> actually avoid an extra variable, and would get rid of the warning.
>

The logic in that code is: if 'reserved' is true, print out the info in
spte[root - leaf]. I am afraid it's not good to use 'leaf' both for the
array index and reserved indicator. Or if i missed something please let
me know.

Actually i triggered this warning in my another box and posted a patch
to fix it which can be found at:
http://lkml.iu.edu/hypermail/linux/kernel/1508.2/02771.html
I guess Paolo is currently busy with KVM forum so the patch has not been
reviewed yet.

The patch simply initialized 'leaf' to the highest value to stop printing
the info, but as you noticed this is no real problem in the code just
stop GCC's complaint.


  reply	other threads:[~2015-09-01  5:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 23:57 [GIT PULL] Early batch of KVM changes for 4.3 merge window Paolo Bonzini
2015-09-01  0:47 ` Linus Torvalds
2015-09-01  5:45   ` Xiao Guangrong [this message]
2015-09-01 17:05     ` Paolo Bonzini
2015-09-01 17:03   ` Paolo Bonzini
2015-09-01 22:34     ` Xiao Guangrong

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=55E53B94.3060407@linux.intel.com \
    --to=guangrong.xiao@linux.intel.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=torvalds@linux-foundation.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