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

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