diff options
author | Keir Fraser <keir@xensource.com> | 2007-10-01 13:18:19 +0100 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-10-01 13:18:19 +0100 |
commit | 10dcd077d24fd3a63791549637e26f9284dfa94b (patch) | |
tree | 58ba45f647ea627ce0d6597ac7487ef31a903810 /tools | |
parent | f53d6f8b4d43f0313b06d780dae4124560a9fa63 (diff) | |
download | xen-10dcd077d24fd3a63791549637e26f9284dfa94b.tar.gz xen-10dcd077d24fd3a63791549637e26f9284dfa94b.tar.bz2 xen-10dcd077d24fd3a63791549637e26f9284dfa94b.zip |
libxenctrl: Fix lock_pages()/unlock_pages() region-size calculation.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libxc/xc_private.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index 18a18f4c65..03d7904d61 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -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 } |