Skip to contentSkip to conversation

fix missing header and gcc warning

PATCH In review Jimi Xenidis 3 participants 3 messages Aug 13, 2006 – Aug 14, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix missing header and gcc warning

Explicaly include <xen/domain_page.h> for map_domain_page() and fix warning. gcc says:
warning: pointer of type 'void *' used in arithmetic
looks like only powerpc has -Wpointer-arith turned on.

---

xen/common/grant_table.c +4 -1
diff -r c87f89fc7be4 xen/common/grant_table.c
@@ -30,6 +30,7 @@
 #include <xen/mm.h>
 #include <xen/trace.h>
 #include <xen/guest_access.h>
+#include <xen/domain_page.h>
 #include <acm/acm_hooks.h>
 
 /*
@@ -902,7 +903,9 @@ __gnttab_copy(
     sp = map_domain_page(s_frame);
     dp = map_domain_page(d_frame);
 
-    memcpy(dp + op->dest.offset, sp + op->source.offset, op->len);
+    memcpy((void *)((ulong)dp + op->dest.offset),
+           (void *)((ulong)sp + op->source.offset),
+           op->len);
 
     unmap_domain_page(dp);
     unmap_domain_page(sp);
#1 lore raw
Quoted 11 lines · Jimi Xenidis

Explicaly include <xen/domain_page.h> for map_domain_page() and fix warning. gcc says:
warning: pointer of type 'void *' used in arithmetic
looks like only powerpc has -Wpointer-arith turned on.

---
diff -r c87f89fc7be4 xen/common/grant_table.c

xen/common/grant_table.c +0 -0

[...]

xen/common/grant_table.c __gnttab_copy( · line 908

Quoted 8 lines
xen/common/grant_table.c +3 -1
@@ -902,7 +903,9 @@ __gnttab_copy(
     sp = map_domain_page(s_frame);
     dp = map_domain_page(d_frame);
 
-    memcpy(dp + op->dest.offset, sp + op->source.offset, op->len);
+    memcpy((void *)((ulong)dp + op->dest.offset),
+           (void *)((ulong)sp + op->source.offset),
+           op->len);

I find this needlessly ugly. Why not just declare sp and dp char *?

Quoted 4 lines
xen/common/grant_table.c +0 -0
     unmap_domain_page(dp);
     unmap_domain_page(sp);
 
#2 lore raw
Quoted 6 lines · Markus Armbruster

xen/common/grant_table.c __gnttab_copy( · line 908

Quoted 4 lines
xen/common/grant_table.c +3 -1
-    memcpy(dp + op->dest.offset, sp + op->source.offset, op->len);
+    memcpy((void *)((ulong)dp + op->dest.offset),
+           (void *)((ulong)sp + op->source.offset),
+           op->len);

I find this needlessly ugly. Why not just declare sp and dp char *?

That's what I checked in.

-- Keir