direct-io.hg

changeset 14089:77298360e365

[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>
author Ian Campbell <ian.campbell@xensource.com>
date Fri Feb 23 16:56:42 2007 +0000 (2007-02-23)
parents 6253b8d32eb9
children e47738923a05
files linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri Feb 23 16:36:55 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri Feb 23 16:56:42 2007 +0000
     1.3 @@ -518,25 +518,26 @@ int gnttab_suspend(void)
     1.4  static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
     1.5  {
     1.6  	struct xen_add_to_physmap xatp;
     1.7 -	unsigned int i;
     1.8 +	unsigned int i = end_idx;
     1.9  
    1.10  	/* Loop backwards, so that the first hypercall has the largest index,
    1.11  	 * ensuring that the table will grow only once.
    1.12  	 */
    1.13 -	for (i = end_idx; i >= start_idx; i--) {
    1.14 +	do {
    1.15  		xatp.domid = DOMID_SELF;
    1.16  		xatp.idx = i;
    1.17  		xatp.space = XENMAPSPACE_grant_table;
    1.18  		xatp.gpfn = (resume_frames >> PAGE_SHIFT) + i;
    1.19  		if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
    1.20  			BUG();
    1.21 -	}
    1.22 +	} while (i-- > start_idx);
    1.23 +
    1.24 +	return 0;
    1.25  }
    1.26  
    1.27  int gnttab_resume(void)
    1.28  {
    1.29 -	struct xen_add_to_physmap xatp;
    1.30 -	unsigned int i, max_nr_gframes, nr_gframes;
    1.31 +	unsigned int max_nr_gframes, nr_gframes;
    1.32  
    1.33  	nr_gframes = nr_grant_frames;
    1.34  	max_nr_gframes = max_nr_grant_frames();