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

[Xen-changelog] [xen-unstable] libxenctrl: Fix lock_pages()/unlock_pages() region-size calculation.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1191241099 -3600
# Node ID 69a74ac976cbc900ec0b26ba99d1e621ffa46953
# Parent  b3814860d170b29daa8ee79eec3a6de603c68b9d
libxenctrl: Fix lock_pages()/unlock_pages() region-size calculation.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 tools/libxc/xc_private.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -r b3814860d170 -r 69a74ac976cb tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Mon Oct 01 09:32:25 2007 +0100
+++ b/tools/libxc/xc_private.c  Mon Oct 01 13:18:19 2007 +0100
@@ -130,7 +130,8 @@ int lock_pages(void *addr, size_t len)
       int e = 0;
 #ifndef __sun__
       void *laddr = (void *)((unsigned long)addr & PAGE_MASK);
-      size_t llen = (len + PAGE_SIZE - 1) & PAGE_MASK;
+      size_t llen = (len + ((unsigned long)addr - (unsigned long)laddr) +
+                     PAGE_SIZE - 1) & PAGE_MASK;
       e = mlock(laddr, llen);
 #endif
       return e;
@@ -140,7 +141,8 @@ void unlock_pages(void *addr, size_t len
 {
 #ifndef __sun__
     void *laddr = (void *)((unsigned long)addr & PAGE_MASK);
-    size_t llen = (len + PAGE_SIZE - 1) & PAGE_MASK;
+    size_t llen = (len + ((unsigned long)addr - (unsigned long)laddr) +
+                   PAGE_SIZE - 1) & PAGE_MASK;
     safe_munlock(laddr, llen);
 #endif
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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