diff options
author | Martin Waitz <tali@admingilde.org> | 2004-11-03 20:08:40 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-11-03 20:08:40 -0800 |
commit | c9e6b4d939b1cd83e0d60387586bbabb4be240f9 (patch) | |
tree | 16f7edf5b0dca5adea251d742f3ca63149b463bb /kernel | |
parent | 78e4291130ee7a68e75e74ac272abd7f8c93e913 (diff) | |
download | history-c9e6b4d939b1cd83e0d60387586bbabb4be240f9.tar.gz |
[PATCH] fix wrong kfifo_init buffer size argument
kfifo_alloc tries to round up the buffer size to the next power of two.
But it accidently uses the original size when calling kfifo_init,
which will BUG.
Acked-by: Stelian Pop <stelian@popies.net>
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kfifo.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 9a5e17b507fe7d..2fbe06a4a6eb83 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c @@ -66,7 +66,6 @@ EXPORT_SYMBOL(kfifo_init); */ struct kfifo *kfifo_alloc(unsigned int size, int gfp_mask, spinlock_t *lock) { - unsigned int newsize; unsigned char *buffer; struct kfifo *ret; @@ -74,13 +73,12 @@ struct kfifo *kfifo_alloc(unsigned int size, int gfp_mask, spinlock_t *lock) * round up to the next power of 2, since our 'let the indices * wrap' tachnique works only in this case. */ - newsize = size; if (size & (size - 1)) { BUG_ON(size > 0x80000000); - newsize = roundup_pow_of_two(size); + size = roundup_pow_of_two(size); } - buffer = kmalloc(newsize, gfp_mask); + buffer = kmalloc(size, gfp_mask); if (!buffer) return ERR_PTR(-ENOMEM); |