lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 16 Apr 2008 06:33:10 -0600
From:	Duck <duck@...escale.com>
To:	linux-kernel@...r.kernel.org
Cc:	Bruce Schmid <duck@...escale.com>, Dean Nelson <dcn@....com>
Subject: [PATCH] generic pool allocator: allow all chunks to be allocated.

From: Bruce Schmid <duck@...escale.com>


gen_pool_alloc() doesn't allocate the last chunk in a pool.
This patch fixes that problem by correcting the calculation
of the number of the last bit in the bitmap.

Cc: Dean Nelson <dcn@....com>
Signed-off-by: Bruce Schmid <duck@...escale.com>
---
 lib/genalloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/genalloc.c b/lib/genalloc.c
index f6d276d..ac00492 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -127,7 +127,7 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
 		chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
 
 		end_bit = (chunk->end_addr - chunk->start_addr) >> order;
-		end_bit -= nbits + 1;
+		end_bit -= (nbits - 1);
 
 		spin_lock_irqsave(&chunk->lock, flags);
 		bit = -1;
-- 
1.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ