Skip to contentSkip to conversation

Don't cast array but use number of uint32_t to copy instead

PATCH New Stefan Berger 1 participant 1 message Aug 7, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't cast array but use number of uint32_t to copy instead

Don't cast the arrays to byte arrays but use the number of uint32_t to copy instead.

xen-unstable.hg/xen/acm/acm_policy.c +6 -8
Index: root/xen-unstable.hg/xen/acm/acm_policy.c
===================================================================
@@ -44,8 +44,6 @@ static void acm_doms_restore_ssidref(voi
 static ssidref_t oldssid_to_newssid(const struct acm_ssid_domain *,
                                     const struct acm_sized_buffer *map);
 
-#define BYTE_ARRAY(a) ((u8 *)(a))
-
 int
 acm_set_policy(XEN_GUEST_HANDLE_64(void) buf, u32 buf_size)
 {
@@ -711,12 +709,12 @@ acm_change_policy(struct acm_change_poli
         goto acm_chg_policy_exit;
     }
 
-    if ( copy_from_guest(BYTE_ARRAY(dels.array),
+    if ( copy_from_guest(dels.array,
                          chgpolicy->del_array,
-                         chgpolicy->delarray_size) ||
-         copy_from_guest(BYTE_ARRAY(ssidmap.array),
+                         dels.num_items) ||
+         copy_from_guest(ssidmap.array,
                          chgpolicy->chg_array,
-                         chgpolicy->chgarray_size) ||
+                         ssidmap.num_items) ||
          copy_from_guest(binpolicy,
                          chgpolicy->policy_pushcache,
                          chgpolicy->policy_pushcache_size ))
@@ -845,9 +843,9 @@ acm_relabel_domains(struct acm_relabel_d
         memset(errors.array, 0x0, sizeof(uint32_t) * errors.num_items);
     }
 
-    if ( copy_from_guest(BYTE_ARRAY(relabels.array),
+    if ( copy_from_guest(relabels.array,
                          relabel->relabel_map,
-                         relabel->relabel_map_size) )
+                         relabels.num_items) )
     {
         rc = -EFAULT;
         goto acm_relabel_doms_exit;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel