From: Bhupinder Thakur <bhupinder.thakur@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: libxc: Fix the data type of mfn parameter passed to xc_map_foreign_range()
Date: Tue, 17 Oct 2017 22:16:32 +0530 [thread overview]
Message-ID: <1508258793-5690-4-git-send-email-bhupinder.thakur@linaro.org> (raw)
In-Reply-To: <1508258793-5690-1-git-send-email-bhupinder.thakur@linaro.org>
Currently the data type of mfn paramter 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>
tools/libxc/include/xenctrl_compat.h | 2 +-
tools/libxc/xc_foreign_memory.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
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);
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-10-17 16:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 16:46 libxl: Fix the bug introduced in commit "libxl: use correct type modifier for vuart_gfn" Bhupinder Thakur
2017-10-17 16:46 ` libxl: Change the type of console_mfn to xen_pfn_t Bhupinder Thakur
2017-10-17 20:43 ` Konrad Rzeszutek Wilk
2017-10-17 16:46 ` xenconsole: Change the type of ring_ref to xen_pfn_t in console_create_ring Bhupinder Thakur
2017-10-17 16:46 ` Bhupinder Thakur [this message]
2017-10-18 11:52 ` libxc: Fix the data type of mfn parameter passed to xc_map_foreign_range() Wei Liu
2017-10-17 16:46 ` xenconsole: Define and use a macro INVALID_XEN_PFN instead of -1 Bhupinder Thakur
2017-10-18 10:02 ` Jan Beulich
2017-10-18 11:53 ` Wei Liu
2017-10-18 13:05 ` Julien Grall
2017-10-18 13:16 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508258793-5690-4-git-send-email-bhupinder.thakur@linaro.org \
--to=bhupinder.thakur@linaro.org \
--cc=ian.jackson@eu.citrix.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).