[PATCH] kexec: change phys_to_virt() to always use 'unsigned long long'.

Eugene Surovegin ebs at ebshome.net
Tue Nov 1 01:36:34 EDT 2011


This fixes physical address truncation by 32-bit binary preparing ELF
headers for 64-bit crash kernel, e.g. 32-bit kexec-tools running on 
x86_64..

Signed-off-by: Eugene Surovegin <ebs at ebshome.net>
---
 kexec/arch/arm/phys_to_virt.c |    4 ++--
 kexec/crashdump.h             |    4 ++--
 kexec/phys_to_virt.c          |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kexec/arch/arm/phys_to_virt.c b/kexec/arch/arm/phys_to_virt.c
index bcced52..ed96cf3 100644
--- a/kexec/arch/arm/phys_to_virt.c
+++ b/kexec/arch/arm/phys_to_virt.c
@@ -13,8 +13,8 @@
  * See also:
  * http://lists.arm.linux.org.uk/lurker/message/20010723.185051.94ce743c.en.html
  */
-unsigned long
-phys_to_virt(struct crash_elf_info *elf_info, unsigned long paddr)
+unsigned long long
+phys_to_virt(struct crash_elf_info *elf_info, unsigned long long paddr)
 {
 	return paddr + elf_info->page_offset - phys_offset;
 }
diff --git a/kexec/crashdump.h b/kexec/crashdump.h
index 0f7c2ea..dab5dc1 100644
--- a/kexec/crashdump.h
+++ b/kexec/crashdump.h
@@ -53,8 +53,8 @@ int crash_create_elf64_headers(struct kexec_info *info,
 
 unsigned long crash_architecture(struct crash_elf_info *elf_info);
 
-unsigned long phys_to_virt(struct crash_elf_info *elf_info,
-			   unsigned long paddr);
+unsigned long long phys_to_virt(struct crash_elf_info *elf_info,
+				unsigned long long paddr);
 
 int xen_present(void);
 unsigned long xen_architecture(struct crash_elf_info *elf_info);
diff --git a/kexec/phys_to_virt.c b/kexec/phys_to_virt.c
index 91b6d01..4d29631 100644
--- a/kexec/phys_to_virt.c
+++ b/kexec/phys_to_virt.c
@@ -9,8 +9,8 @@
  * PAGE_OFFSET. Architectures that don't follow this convention should provide
  * their own implementation.
  */
-unsigned long
-phys_to_virt(struct crash_elf_info *elf_info, unsigned long paddr)
+unsigned long long
+phys_to_virt(struct crash_elf_info *elf_info, unsigned long long paddr)
 {
 	return paddr + elf_info->page_offset;
 }
-- 
1.7.3.4




More information about the kexec mailing list