diff options
author | Ian Campbell <ian.campbell@xensource.com> | 2007-02-23 16:56:42 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@xensource.com> | 2007-02-23 16:56:42 +0000 |
commit | 8c994baaf3cc6d3eab424a979cf1d86917e92426 (patch) | |
tree | 4cc23e0637437e3adc0604df4a248a7b4eff837c /linux-2.6-xen-sparse | |
parent | 07a46fde3570d9bb47a988e87259de229f437215 (diff) | |
download | xen-8c994baaf3cc6d3eab424a979cf1d86917e92426.tar.gz xen-8c994baaf3cc6d3eab424a979cf1d86917e92426.tar.bz2 xen-8c994baaf3cc6d3eab424a979cf1d86917e92426.zip |
[PV-on-HVM] Fix gnttab_map to not run off the bottom of the gnttab space.
Cleanup a few warnings: reached end of void function and unused variables.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Diffstat (limited to 'linux-2.6-xen-sparse')
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/core/gnttab.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c index 80226fb6e8..2890b981a0 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c @@ -518,25 +518,26 @@ int gnttab_suspend(void) static int gnttab_map(unsigned int start_idx, unsigned int end_idx) { struct xen_add_to_physmap xatp; - unsigned int i; + unsigned int i = end_idx; /* Loop backwards, so that the first hypercall has the largest index, * ensuring that the table will grow only once. */ - for (i = end_idx; i >= start_idx; i--) { + do { xatp.domid = DOMID_SELF; xatp.idx = i; xatp.space = XENMAPSPACE_grant_table; xatp.gpfn = (resume_frames >> PAGE_SHIFT) + i; if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) BUG(); - } + } while (i-- > start_idx); + + return 0; } int gnttab_resume(void) { - struct xen_add_to_physmap xatp; - unsigned int i, max_nr_gframes, nr_gframes; + unsigned int max_nr_gframes, nr_gframes; nr_gframes = nr_grant_frames; max_nr_gframes = max_nr_grant_frames(); |