ia64/xen-unstable

changeset 17879:a1c98534418b

minios: fix gnttab allocation boundary

The gnttab_sem is already fed during initialization's put_free_entry
loop.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 18 09:38:11 2008 +0100 (2008-06-18)
parents 75e60df67e36
children 9493a853df9e
files extras/mini-os/gnttab.c
line diff
     1.1 --- a/extras/mini-os/gnttab.c	Wed Jun 18 09:37:40 2008 +0100
     1.2 +++ b/extras/mini-os/gnttab.c	Wed Jun 18 09:38:11 2008 +0100
     1.3 @@ -35,7 +35,7 @@ static grant_ref_t gnttab_list[NR_GRANT_
     1.4  #ifdef GNT_DEBUG
     1.5  static char inuse[NR_GRANT_ENTRIES];
     1.6  #endif
     1.7 -static __DECLARE_SEMAPHORE_GENERIC(gnttab_sem, NR_GRANT_ENTRIES);
     1.8 +static __DECLARE_SEMAPHORE_GENERIC(gnttab_sem, 0);
     1.9  
    1.10  static void
    1.11  put_free_entry(grant_ref_t ref)
    1.12 @@ -60,6 +60,7 @@ get_free_entry(void)
    1.13      down(&gnttab_sem);
    1.14      local_irq_save(flags);
    1.15      ref = gnttab_list[0];
    1.16 +    BUG_ON(ref < NR_RESERVED_ENTRIES || ref >= NR_GRANT_ENTRIES);
    1.17      gnttab_list[0] = gnttab_list[ref];
    1.18  #ifdef GNT_DEBUG
    1.19      BUG_ON(inuse[ref]);