Blame SOURCES/0024-Fix-page-offset-issue-when-converting-physical-to-vi.patch

56ae9b
From d0726d96b92e5dacd1df56756e168a50a4e62589 Mon Sep 17 00:00:00 2001
56ae9b
From: Tao Liu <ltao@redhat.com>
56ae9b
Date: Mon, 19 Sep 2022 17:49:22 +0800
56ae9b
Subject: [PATCH 24/28] Fix page offset issue when converting physical to
56ae9b
 virtual address
56ae9b
56ae9b
When trying to convert a physical address to its virtual
56ae9b
address in dump_vmap_area() and dump_vmlist(), the vi->retval
56ae9b
is added by 2 values: the page aligned address "pcheck"
56ae9b
and page offset address "PAGEOFFSET(paddr)".
56ae9b
56ae9b
However "paddr" is given by "pcheck", is also page aligned,
56ae9b
so "PAGEOFFSET(paddr)" is always 0.
56ae9b
56ae9b
In this patch, we will use PAGEOFFSET(vi->spec_addr) to give the
56ae9b
page offset, vi->spec_addr is the physical address we'd like
56ae9b
to convert, which contains the correct page offset.
56ae9b
56ae9b
Signed-off-by: Tao Liu <ltao@redhat.com>
56ae9b
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
56ae9b
---
56ae9b
 memory.c | 4 ++--
56ae9b
 1 file changed, 2 insertions(+), 2 deletions(-)
56ae9b
56ae9b
diff --git a/memory.c b/memory.c
56ae9b
index e44b59d2e805..a60c3f9493f6 100644
56ae9b
--- a/memory.c
56ae9b
+++ b/memory.c
56ae9b
@@ -8861,7 +8861,7 @@ dump_vmlist(struct meminfo *vi)
56ae9b
 				    (vi->spec_addr < (paddr+PAGESIZE()))) {
56ae9b
 					if (vi->flags & GET_PHYS_TO_VMALLOC) {
56ae9b
 						vi->retval = pcheck +
56ae9b
-						    PAGEOFFSET(paddr);
56ae9b
+						    PAGEOFFSET(vi->spec_addr);
56ae9b
 						return;
56ae9b
 				        } else
56ae9b
 						fprintf(fp,
56ae9b
@@ -9010,7 +9010,7 @@ dump_vmap_area(struct meminfo *vi)
56ae9b
 				    (vi->spec_addr < (paddr+PAGESIZE()))) {
56ae9b
 					if (vi->flags & GET_PHYS_TO_VMALLOC) {
56ae9b
 						vi->retval = pcheck +
56ae9b
-						    PAGEOFFSET(paddr);
56ae9b
+						    PAGEOFFSET(vi->spec_addr);
56ae9b
 						FREEBUF(ld->list_ptr);
56ae9b
 						return;
56ae9b
 				        } else
56ae9b
-- 
56ae9b
2.37.1
56ae9b