aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/gnttab.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-06-18 09:38:11 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-06-18 09:38:11 +0100
commit030c31dd18ad7dc1c71d6502c577762e467cdb92 (patch)
treeff6fda576fddf5dde8797157eede32d91a78b154 /extras/mini-os/gnttab.c
parent5201eb72cb358ddaf500356257e9a1d1827ba84d (diff)
downloadxen-030c31dd18ad7dc1c71d6502c577762e467cdb92.tar.gz
xen-030c31dd18ad7dc1c71d6502c577762e467cdb92.tar.bz2
xen-030c31dd18ad7dc1c71d6502c577762e467cdb92.zip
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>
Diffstat (limited to 'extras/mini-os/gnttab.c')
-rw-r--r--extras/mini-os/gnttab.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/extras/mini-os/gnttab.c b/extras/mini-os/gnttab.c
index d94c28b815..18fd87e29c 100644
--- a/extras/mini-os/gnttab.c
+++ b/extras/mini-os/gnttab.c
@@ -35,7 +35,7 @@ static grant_ref_t gnttab_list[NR_GRANT_ENTRIES];
#ifdef GNT_DEBUG
static char inuse[NR_GRANT_ENTRIES];
#endif
-static __DECLARE_SEMAPHORE_GENERIC(gnttab_sem, NR_GRANT_ENTRIES);
+static __DECLARE_SEMAPHORE_GENERIC(gnttab_sem, 0);
static void
put_free_entry(grant_ref_t ref)
@@ -60,6 +60,7 @@ get_free_entry(void)
down(&gnttab_sem);
local_irq_save(flags);
ref = gnttab_list[0];
+ BUG_ON(ref < NR_RESERVED_ENTRIES || ref >= NR_GRANT_ENTRIES);
gnttab_list[0] = gnttab_list[ref];
#ifdef GNT_DEBUG
BUG_ON(inuse[ref]);