KVM: x86/mmu: Remove unnecessary ‘NULL’ values from sptep
authorLi zeming <zeming@nfschina.com>
Tue, 5 Sep 2023 18:20:06 +0000 (02:20 +0800)
committerSean Christopherson <seanjc@google.com>
Wed, 18 Oct 2023 21:34:28 +0000 (14:34 -0700)
commit1de9992f9de0a92b6e11133aba0e2be833c11084
tree535552bfb3636e440a654188008c6f66e9c03ca6
parentc9f65a3f2d92e0de336177d0151dabaf3ed004e5
KVM: x86/mmu: Remove unnecessary ‘NULL’ values from sptep

Don't initialize "spte" and "sptep" in fast_page_fault() as they are both
guaranteed (for all intents and purposes) to be written at the start of
every loop iteration.  Add a sanity check that "sptep" is non-NULL after
walking the shadow page tables, as encountering a NULL root would result
in "spte" not being written, i.e. would lead to uninitialized data or the
previous value being consumed.

Signed-off-by: Li zeming <zeming@nfschina.com>
Link: https://lore.kernel.org/r/20230905182006.2964-1-zeming@nfschina.com
[sean: rewrite changelog with --verbose]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c