[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [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 <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 tools/libvchan/init.c        | 4 ++--
 tools/libvchan/io.c          | 4 ++--
 tools/libxc/xc_linux_osdep.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
index 0c7cff6..f0d2505 100644
--- a/tools/libvchan/init.c
+++ b/tools/libvchan/init.c
@@ -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;
diff --git a/tools/libvchan/io.c b/tools/libvchan/io.c
index 3c8d236..5ec5fb9 100644
--- a/tools/libvchan/io.c
+++ b/tools/libvchan/io.c
@@ -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) {
diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c
index 36832b6..3c43fca 100644
--- a/tools/libxc/xc_linux_osdep.c
+++ b/tools/libxc/xc_linux_osdep.c
@@ -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 = {
-- 
1.8.1.4



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.