[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [TOOLS] Avoid void* arithmetic when parsing elf notes.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Date 1169219120 0 # Node ID 5d08bf268f92fdf9febe4f3a99bd936f14a863a3 # Parent 1e5ad8ccb286300643fb7e8d59a8bd01b7ccdc81 [TOOLS] Avoid void* arithmetic when parsing elf notes. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- tools/libxc/xc_load_elf.c | 10 +++++----- tools/xcutils/readnotes.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff -r 1e5ad8ccb286 -r 5d08bf268f92 tools/libxc/xc_load_elf.c --- a/tools/libxc/xc_load_elf.c Fri Jan 19 15:03:02 2007 +0000 +++ b/tools/libxc/xc_load_elf.c Fri Jan 19 15:05:20 2007 +0000 @@ -177,7 +177,7 @@ static unsigned long long xen_guest_nume /* * Interface to the Xen ELF notes. */ -#define ELFNOTE_NAME(_n_) ((const void*)(_n_) + sizeof(*(_n_))) +#define ELFNOTE_NAME(_n_) ((const char*)(_n_) + sizeof(*(_n_))) #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3)) #define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3)) @@ -190,7 +190,7 @@ static int is_xen_elfnote_section(const for ( note = (const Elf_Note *)(image + shdr->sh_offset); note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size); - note = ELFNOTE_NEXT(note) ) + note = (const Elf_Note *)ELFNOTE_NEXT(note) ) { if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) ) return 1; @@ -209,7 +209,7 @@ static const Elf_Note *xen_elfnote_looku for ( note = (const Elf_Note *)dsi->__elfnote_section; note < (const Elf_Note *)dsi->__elfnote_section_end; - note = ELFNOTE_NEXT(note) ) + note = (const Elf_Note *)ELFNOTE_NEXT(note) ) { if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) ) continue; @@ -338,9 +338,9 @@ static int parseelfimage(const char *ima image + ehdr->e_shoff + (h*ehdr->e_shentsize)); if ( !is_xen_elfnote_section(image, shdr) ) continue; - dsi->__elfnote_section = (const void *)image + shdr->sh_offset; + dsi->__elfnote_section = (const char *)image + shdr->sh_offset; dsi->__elfnote_section_end = - (const void *)image + shdr->sh_offset + shdr->sh_size; + (const char *)image + shdr->sh_offset + shdr->sh_size; break; } diff -r 1e5ad8ccb286 -r 5d08bf268f92 tools/xcutils/readnotes.c --- a/tools/xcutils/readnotes.c Fri Jan 19 15:03:02 2007 +0000 +++ b/tools/xcutils/readnotes.c Fri Jan 19 15:05:20 2007 +0000 @@ -13,7 +13,7 @@ #include <xen/elfnote.h> -#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_))) +#define ELFNOTE_NAME(_n_) ((char*)(_n_) + sizeof(*(_n_))) #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + (((_n_)->n_namesz+3)&~3)) #define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + (((_n_)->n_descsz+3)&~3)) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |