[PATCH v3 04/12] KVM: x86/mmu: Avoid pointer arithmetic when iterating over SPTEs
From: Sean Christopherson
Date: Fri Jul 28 2023 - 20:49:19 EST
Replace the pointer arithmetic used to iterate over SPTEs in
is_empty_shadow_page() with more standard interger-based iteration.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/mmu/mmu.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index b16092d71d3f..08d08f34e6a3 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1696,15 +1696,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
--
2.41.0.487.g6d72f3e995-goog