libxc: fix xc_gntshr_munmap semantic
PATCH v2 1/2 libxc: fix xc_gntshr_munmap semantic
"count" parameter should be pages count (as stated in comment in xenctrl.h), not bytes count.
This patch fixes also the only user of this function (in xen sources) - libvchan.
Changes in v2:
- Split munmap->xc_gntshr_munmap libvchan fix into separate patch
Signed-off-by Marek Marczykowski <[email protected]>
--- tools/libvchan/init.c | 4 ++-- tools/libvchan/io.c | 4 ++-- tools/libxc/xc_linux_osdep.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
tools/libvchan/init.c +2 -2
@@ -129,9 +129,9 @@ out:return ring_ref; out_unmap_left:if (pages_left) -xc_gntshr_munmap (ctrl->gntshr, ctrl->read.buffer, pages_left *PAGE_SIZE ); +xc_gntshr_munmap (ctrl->gntshr, ctrl->read.buffer, pages_left); out_ring: -xc_gntshr_munmap (ctrl->gntshr, ring,PAGE_SIZE ); +xc_gntshr_munmap (ctrl->gntshr, ring,1 ); ring_ref =-1 ; ctrl->ring =NULL ; ctrl->write.order = ctrl->read.order =0 ;
tools/libvchan/io.c +2 -2
@@ -330,10 +330,10 @@ void libxenvchan_close(struct libxenvchan *ctrl)if (ctrl->ring) {if (ctrl->is_server) { ctrl->ring->srv_live =0 ; -xc_gntshr_munmap (ctrl->gntshr, ctrl->ring,PAGE_SIZE ); +xc_gntshr_munmap (ctrl->gntshr, ctrl->ring,1 ); }else { ctrl->ring->cli_live =0 ; -xc_gnttab_munmap (ctrl->gnttab, ctrl->ring,PAGE_SIZE ); +xc_gnttab_munmap (ctrl->gnttab, ctrl->ring,1 ); } }if (ctrl->event) {
tools/libxc/xc_linux_osdep.c +1 -1
@@ -825,7 +825,7 @@ static void *linux_gntshr_share_pages(xc_gntshr *xch, xc_osdep_handle h,static int linux_gntshr_munmap (xc_gntshr *xcg,xc_osdep_handle h,void *start_address,uint32_t count) { -return munmap (start_address, count); +return munmap (start_address, count *XC_PAGE_SIZE ); }static struct xc_osdep_ops linux_gntshr_ops = {
Signature · 1 line
1.8.1.4