aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Christopherson <[email protected]>2023-07-28 17:47:14 -0700
committerPaolo Bonzini <[email protected]>2023-08-31 13:48:42 -0400
commit242a6dd8daddbc718a3ad585ce4dce042c13e208 (patch)
tree9a0fbdf95452e6b76178bb47e76e4868bf7b1a1a
parentc4f92cfe021d9263a554f8adcd7c49ef52e485bb (diff)
KVM: x86/mmu: Avoid pointer arithmetic when iterating over SPTEs
Replace the pointer arithmetic used to iterate over SPTEs in is_empty_shadow_page() with more standard interger-based iteration. No functional change intended. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
-rw-r--r--arch/x86/kvm/mmu/mmu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 8e0b7ad64333..3749ccdef6ce 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1692,15 +1692,15 @@ bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
#ifdef MMU_DEBUG
static int is_empty_shadow_page(u64 *spt)
{
- u64 *pos;
- u64 *end;
+ int i;
- for (pos = spt, end = pos + SPTE_ENT_PER_PAGE; pos != end; pos++)
- if (is_shadow_present_pte(*pos)) {
+ for (i = 0; i < SPTE_ENT_PER_PAGE; i++) {
+ if (is_shadow_present_pte(spt[i])) {
printk(KERN_ERR "%s: %p %llx\n", __func__,
- pos, *pos);
+ &spt[i], spt[i]);
return 0;
}
+ }
return 1;
}
#endif