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-devel

[Xen-devel] [patch] fix void* arithmetic

To: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Subject: [Xen-devel] [patch] fix void* arithmetic
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Tue, 29 Aug 2006 15:24:48 -0500
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 29 Aug 2006 13:25:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Ian, I needed the following patch to avoid lots of these warnings:
        elf.c:238: warning: pointer of type `void *' used in arithmetic

Fix void* arithmetic warnings.
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>

diff -r 030a041bbe90 xen/common/elf.c
--- a/xen/common/elf.c  Tue Aug 29 06:53:58 2006 -0400
+++ b/xen/common/elf.c  Tue Aug 29 15:22:26 2006 -0500
@@ -102,9 +102,9 @@ static unsigned long long xen_guest_nume
 /*
  * Interface to the Xen ELF notes.
  */
-#define ELFNOTE_NAME(_n_)   ((void*)(_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))
+#define ELFNOTE_NAME(_n_)   ((void*)((char*)(_n_) + sizeof(*(_n_))))
+#define ELFNOTE_DESC(_n_)   (((void*)((char*)ELFNOTE_NAME(_n_) + 
(((_n_)->namesz+3)&~3))))
+#define ELFNOTE_NEXT(_n_)   (((void*)((char*)ELFNOTE_DESC(_n_) + 
(((_n_)->descsz+3)&~3))))

 static int is_xen_elfnote_section(const char *image, Elf_Shdr *shdr)
 {
@@ -235,9 +235,9 @@ int parseelfimage(struct domain_setup_in
         shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
         if ( !is_xen_elfnote_section(image, shdr) )
             continue;
-        dsi->__elfnote_section = (void *)image + shdr->sh_offset;
+        dsi->__elfnote_section = (char *)image + shdr->sh_offset;
         dsi->__elfnote_section_end =
-            (void *)image + shdr->sh_offset + shdr->sh_size;
+            (char *)image + shdr->sh_offset + shdr->sh_size;
         break;
     }



-- 
Hollis Blanchard
IBM Linux Technology Center


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