[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] Avoid void* arithmetic in kexec ELF note manipulations.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1169479744 0
# Node ID 66cc1685d95726d93dceeee1e64f34416be2f742
# Parent  207523704fb15ae92b1852bb7e1f0e739ed01fb3
[XEN] Avoid void* arithmetic in kexec ELF note manipulations.

From: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 xen/common/kexec.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -r 207523704fb1 -r 66cc1685d957 xen/common/kexec.c
--- a/xen/common/kexec.c        Mon Jan 22 15:15:32 2007 +0000
+++ b/xen/common/kexec.c        Mon Jan 22 15:29:04 2007 +0000
@@ -27,9 +27,9 @@ typedef long ret_t;
 typedef long ret_t;
 
 #define ELFNOTE_ALIGN(_n_) (((_n_)+3)&~3)
-#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_)))
+#define ELFNOTE_NAME(_n_) ((char*)(_n_) + sizeof(*(_n_)))
 #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + ELFNOTE_ALIGN((_n_)->namesz))
-#define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + ELFNOTE_ALIGN((_n_)->descsz))
+#define ELFNOTE_NEXT(_n_) ((Elf_Note *)(ELFNOTE_DESC(_n_) + 
ELFNOTE_ALIGN((_n_)->descsz)))
 
 static DEFINE_PER_CPU(void *, crash_notes);
 
@@ -75,10 +75,10 @@ void kexec_crash_save_cpu(void)
     if ( cpu_test_and_set(cpu, crash_saved_cpus) )
         return;
 
-    prstatus = ELFNOTE_DESC(note);
+    prstatus = (ELF_Prstatus *)ELFNOTE_DESC(note);
 
     note = ELFNOTE_NEXT(note);
-    xencore = ELFNOTE_DESC(note);
+    xencore = (crash_xen_core_t *)ELFNOTE_DESC(note);
 
     elf_core_save_regs(&prstatus->pr_reg, xencore);
 }
@@ -87,7 +87,7 @@ crash_xen_info_t *kexec_crash_save_info(
 crash_xen_info_t *kexec_crash_save_info(void)
 {
     int cpu = smp_processor_id();
-    crash_xen_info_t *info = ELFNOTE_DESC(xen_crash_note);
+    crash_xen_info_t *info = (crash_xen_info_t *)ELFNOTE_DESC(xen_crash_note);
 
     BUG_ON(!cpu_test_and_set(cpu, crash_saved_cpus));
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.