Skip to content

Commit

Permalink
KVM: Drop bogus "pfn != 0" guard from kvm_release_pfn()
Browse files Browse the repository at this point in the history
Remove a check from kvm_release_pfn() to bail if the provided @pfn is
zero.  Zero is a perfectly valid pfn on most architectures, and should
not be used to indicate an error or an invalid pfn.  The bogus check was
added by commit 9172481 ("x86/kvm: Cache gfn to pfn translation"),
which also did the bad thing of zeroing the pfn and gfn to mark a cache
invalid.  Thankfully, that bad behavior was axed by commit 357a18a
("KVM: Kill kvm_map_gfn() / kvm_unmap_gfn() and gfn_to_pfn_cache").

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220429010416.2788472-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
sean-jc authored and bonzini committed Jun 20, 2022
1 parent 70e41c3 commit 28b85ae
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2745,9 +2745,6 @@ EXPORT_SYMBOL_GPL(gfn_to_page);

void kvm_release_pfn(kvm_pfn_t pfn, bool dirty)
{
if (pfn == 0)
return;

if (dirty)
kvm_release_pfn_dirty(pfn);
else
Expand Down

0 comments on commit 28b85ae

Please sign in to comment.