Message ID | 1508923628-26446-3-git-send-email-bhupinder.thakur@linaro.org |
---|---|
State | New |
Headers | show |
Series | [Xen-devel,1/5,v2] libxl: Fix the bug introduced in commit "libxl: use correct type modifier for vuart_gfn" | expand |
On Wed, Oct 25, 2017 at 02:57:06PM +0530, Bhupinder Thakur wrote: > Currently the data type of mfn parameter passed to xc_map_foreign_range() is unsigned > long. This could be problem for 32-bit arm architectures where the lengh of long is > 32 bits while mfn happens to be a 64-bit value. > > To avoid truncating a 64-bit value, the type of mfn is changed from "unsigned long" to > xen_pfn_t. Also the parameter name "mfn" is changed to "pfn" which is a more accurate > indication of what this parameter represents. > > Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org> Acked-by: Wei Liu <wei.liu2@citrix.com> But this should either come before #2 or be squashed into it.
diff --git a/tools/libxc/include/xenctrl_compat.h b/tools/libxc/include/xenctrl_compat.h index a655e47..5ee72bf 100644 --- a/tools/libxc/include/xenctrl_compat.h +++ b/tools/libxc/include/xenctrl_compat.h @@ -26,7 +26,7 @@ */ void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn ); + xen_pfn_t pfn); void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, const xen_pfn_t *arr, int num ); diff --git a/tools/libxc/xc_foreign_memory.c b/tools/libxc/xc_foreign_memory.c index 4053d26..c1f114a 100644 --- a/tools/libxc/xc_foreign_memory.c +++ b/tools/libxc/xc_foreign_memory.c @@ -33,7 +33,7 @@ void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot, void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn) + xen_pfn_t pfn) { xen_pfn_t *arr; int num; @@ -46,7 +46,7 @@ void *xc_map_foreign_range(xc_interface *xch, return NULL; for ( i = 0; i < num; i++ ) - arr[i] = mfn + i; + arr[i] = pfn + i; ret = xc_map_foreign_pages(xch, dom, prot, arr, num); free(arr);
Currently the data type of mfn parameter passed to xc_map_foreign_range() is unsigned long. This could be problem for 32-bit arm architectures where the lengh of long is 32 bits while mfn happens to be a 64-bit value. To avoid truncating a 64-bit value, the type of mfn is changed from "unsigned long" to xen_pfn_t. Also the parameter name "mfn" is changed to "pfn" which is a more accurate indication of what this parameter represents. Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org> --- CC: Ian Jackson <ian.jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: Julien Grall <julien.grall@arm.com> This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type tools/libxc/include/xenctrl_compat.h | 2 +- tools/libxc/xc_foreign_memory.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)