Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window

From: Xiao Guangrong
Date: Tue Sep 01 2015 - 01:52:01 EST

Linus, I am sorry for the annoyance.

On 09/01/2015 08:47 AM, Linus Torvalds wrote:

On Fri, Aug 14, 2015 at 4:57 PM, Paolo Bonzini <pbonzini@xxxxxxxxxx> 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:
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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at