aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorImre Deak <imre.deak@nokia.com>2010-06-29 18:05:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-06-29 18:29:30 -0400
commite621ba9932aa0a90e47c12c958b3a3104915f3b9 (patch)
tree2481974f86f41cb47322fe52e6390f9db5d97968 /lib
parent984bc9601f64fd341b8573021d7c999f1f1499a9 (diff)
genalloc: fix allocation from end of pool
bitmap_find_next_zero_area requires the size of the bitmap, we instead passed the last suitable position. This made it impossible to allocate from the end of the pool. Fixes a regression introduced by 243797f59b748f679ab88d456fcc4f92236d724b ("genalloc: use bitmap_find_next_zero_area"). Signed-off-by: Imre Deak <imre.deak@nokia.com> Cc: Zygo Blaxell <zygo.blaxell@xandros.com> Cc: Tejun Heo <tj@kernel.org> Acked-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/genalloc.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 736c3b06398..1923f1490e7 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -128,7 +128,6 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
128 chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk); 128 chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
129 129
130 end_bit = (chunk->end_addr - chunk->start_addr) >> order; 130 end_bit = (chunk->end_addr - chunk->start_addr) >> order;
131 end_bit -= nbits + 1;
132 131
133 spin_lock_irqsave(&chunk->lock, flags); 132 spin_lock_irqsave(&chunk->lock, flags);
134 start_bit = bitmap_find_next_zero_area(chunk->bits, end_bit, 0, 133 start_bit = bitmap_find_next_zero_area(chunk->bits, end_bit, 0,