From: Stefan Berger Subject: [PATCH] [ACM] Explicitly cast byte arrays when used in copy_from_guest Date: Mon, 06 Aug 2007 17:37:56 -0400 Message-ID: <1186436276.9304.19.camel@gsal-3.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-hSWyzNPNotpjU8wwBbE/" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-hSWyzNPNotpjU8wwBbE/ Content-Type: text/plain Content-Transfer-Encoding: 7bit Explicitly cast the target array type to an array of 'u8' since the number of bytes copied is calculated from the type of element in the target array times the number of elements (3rd parameter). Signed-off-by: Stefan Berger --=-hSWyzNPNotpjU8wwBbE/ Content-Disposition: attachment; filename=copy_from_guest_cast.diff Content-Type: text/x-patch; name=copy_from_guest_cast.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit --- xen-unstable.hg/xen/acm/acm_policy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Index: root/xen-unstable.hg/xen/acm/acm_policy.c =================================================================== --- root.orig/xen-unstable.hg/xen/acm/acm_policy.c +++ root/xen-unstable.hg/xen/acm/acm_policy.c @@ -44,6 +44,7 @@ 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) @@ -710,10 +711,10 @@ acm_change_policy(struct acm_change_poli goto acm_chg_policy_exit; } - if ( copy_from_guest(dels.array, + if ( copy_from_guest(BYTE_ARRAY(dels.array), chgpolicy->del_array, chgpolicy->delarray_size) || - copy_from_guest(ssidmap.array, + copy_from_guest(BYTE_ARRAY(ssidmap.array), chgpolicy->chg_array, chgpolicy->chgarray_size) || copy_from_guest(binpolicy, @@ -844,7 +845,7 @@ acm_relabel_domains(struct acm_relabel_d memset(errors.array, 0x0, sizeof(uint32_t) * errors.num_items); } - if ( copy_from_guest(relabels.array, + if ( copy_from_guest(BYTE_ARRAY(relabels.array), relabel->relabel_map, relabel->relabel_map_size) ) { --=-hSWyzNPNotpjU8wwBbE/ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-hSWyzNPNotpjU8wwBbE/--