ia64/xen-unstable

changeset 13519:1e5ad8ccb286

[XEN] Avoid void* arithmetic in elfnote code.
From: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Jan 19 15:03:02 2007 +0000 (2007-01-19)
parents 1a45828882e9
children 5d08bf268f92
files xen/common/elf.c
line diff
     1.1 --- a/xen/common/elf.c	Fri Jan 19 14:41:17 2007 +0000
     1.2 +++ b/xen/common/elf.c	Fri Jan 19 15:03:02 2007 +0000
     1.3 @@ -102,7 +102,7 @@ static unsigned long long xen_guest_nume
     1.4  /*
     1.5   * Interface to the Xen ELF notes.
     1.6   */
     1.7 -#define ELFNOTE_NAME(_n_)   ((const void*)(_n_) + sizeof(*(_n_)))
     1.8 +#define ELFNOTE_NAME(_n_)   ((const char*)(_n_) + sizeof(*(_n_)))
     1.9  #define ELFNOTE_DESC(_n_)   (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3))
    1.10  #define ELFNOTE_NEXT(_n_)   (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3))
    1.11  
    1.12 @@ -115,7 +115,7 @@ static int is_xen_elfnote_section(const 
    1.13  
    1.14      for ( note = (const Elf_Note *)(image + shdr->sh_offset);
    1.15            note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
    1.16 -          note = ELFNOTE_NEXT(note) )
    1.17 +          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
    1.18      {
    1.19          if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) )
    1.20              return 1;
    1.21 @@ -134,7 +134,7 @@ static const Elf_Note *xen_elfnote_looku
    1.22  
    1.23      for ( note = (const Elf_Note *)dsi->__elfnote_section;
    1.24            note < (const Elf_Note *)dsi->__elfnote_section_end;
    1.25 -          note = ELFNOTE_NEXT(note) )
    1.26 +          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
    1.27      {
    1.28          if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) )
    1.29              continue;
    1.30 @@ -227,9 +227,9 @@ int parseelfimage(struct domain_setup_in
    1.31              image + ehdr->e_shoff + (h*ehdr->e_shentsize));
    1.32          if ( !is_xen_elfnote_section(image, shdr) )
    1.33              continue;
    1.34 -        dsi->__elfnote_section = (const void *)image + shdr->sh_offset;
    1.35 +        dsi->__elfnote_section = (const char *)image + shdr->sh_offset;
    1.36          dsi->__elfnote_section_end =
    1.37 -            (const void *)image + shdr->sh_offset + shdr->sh_size;
    1.38 +            (const char *)image + shdr->sh_offset + shdr->sh_size;
    1.39          break;
    1.40      }
    1.41