All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virt/kvm/kvm_main.c: use vma_pages() helper
@ 2021-05-26 14:00  Zhongjun Tan
  0 siblings, 0 replies; only message in thread
From:  Zhongjun Tan @ 2021-05-26 14:00 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, linux-kernel, Tan Zhongjun

From: Tan Zhongjun <tanzhongjun@yulong.com>

Use vma_pages function on vma object instead of explicit computation.
./virt/kvm/kvm_main.c:3247:29-35: WARNING: Consider using vma_pages helper on vma

Signed-off-by: Tan Zhongjun <tanzhongjun@yulong.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 6b4feb92dc79..1ac52cd1111d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3244,7 +3244,7 @@ static const struct vm_operations_struct kvm_vcpu_vm_ops = {
 static int kvm_vcpu_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct kvm_vcpu *vcpu = file->private_data;
-	unsigned long pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+	unsigned long pages = vma_pages(vma);
 
 	if ((kvm_page_in_dirty_ring(vcpu->kvm, vma->vm_pgoff) ||
 	     kvm_page_in_dirty_ring(vcpu->kvm, vma->vm_pgoff + pages - 1)) &&
-- 
2.17.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-26 14:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 14:00 [PATCH] virt/kvm/kvm_main.c: use vma_pages() helper  Zhongjun Tan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.