WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [TOOLS] Avoid void* arithmetic when parsi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [TOOLS] Avoid void* arithmetic when parsing elf notes.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Jan 2007 10:45:15 -0800
Delivery-date: Fri, 19 Jan 2007 10:46:36 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [TOOLS] Avoid void* arithmetic when parsing elf notes., Xen patchbot-unstable <=