diff options
author | Bibo Mao <maobibo@loongson.cn> | 2024-06-13 20:28:03 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-06-20 17:20:11 -0400 |
commit | 676f819c3e982db3695a371f336a05086585ea4f (patch) | |
tree | 0fbc0e6cfed74402610d4507c92f3f0429728bba /virt | |
parent | c31745d2c508796a0996c88bf2e55f552d513f65 (diff) | |
download | linux-676f819c3e982db3695a371f336a05086585ea4f.tar.gz linux-676f819c3e982db3695a371f336a05086585ea4f.tar.bz2 linux-676f819c3e982db3695a371f336a05086585ea4f.zip |
KVM: Discard zero mask with function kvm_dirty_ring_reset
Function kvm_reset_dirty_gfn may be called with parameters cur_slot /
cur_offset / mask are all zero, it does not represent real dirty page.
It is not necessary to clear dirty page in this condition. Also return
value of macro __fls() is undefined if mask is zero which is called in
funciton kvm_reset_dirty_gfn(). Here just return.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Message-ID: <20240613122803.1031511-1-maobibo@loongson.cn>
[Move the conditional inside kvm_reset_dirty_gfn; suggested by
Sean Christopherson. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/dirty_ring.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/virt/kvm/dirty_ring.c b/virt/kvm/dirty_ring.c index 86d267db87bb..7bc74969a819 100644 --- a/virt/kvm/dirty_ring.c +++ b/virt/kvm/dirty_ring.c @@ -55,6 +55,9 @@ static void kvm_reset_dirty_gfn(struct kvm *kvm, u32 slot, u64 offset, u64 mask) struct kvm_memory_slot *memslot; int as_id, id; + if (!mask) + return; + as_id = slot >> 16; id = (u16)slot; |