Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1c2de47cd47daa033251dbb4a3643e7e87a681b0 Commit: 1c2de47cd47daa033251dbb4a3643e7e87a681b0 Parent: 991eb43af989002d5c7f4a2ff2a6c806a912b51b Author: Timur Tabi <[EMAIL PROTECTED]> AuthorDate: Mon May 14 11:31:26 2007 -0500 Committer: Paul Mackerras <[EMAIL PROTECTED]> CommitDate: Thu May 17 21:10:16 2007 +1000
[POWERPC] Fix alignment problem in rh_alloc_align() with exact-sized blocks When an rheap is created, the caller can specify the alignment to use. In rh_alloc_align(), if a free block is found that is the exact size needed (including extra space for alignment), that configured alignment value is not used to align the pointer. Instead, the default alignment is used. If the default alignment is smaller than the configured alignment, then the returned value will not be aligned correctly. Signed-off-by: Timur Tabi <[EMAIL PROTECTED]> Signed-off-by: Kumar Gala <[EMAIL PROTECTED]> --- arch/powerpc/lib/rheap.c | 22 ++++++++-------------- 1 files changed, 8 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c index b2f6dcc..180ee29 100644 --- a/arch/powerpc/lib/rheap.c +++ b/arch/powerpc/lib/rheap.c @@ -468,25 +468,19 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch if (blk->size == size) { /* Move from free list to taken list */ list_del(&blk->list); - blk->owner = owner; - start = blk->start; - - attach_taken_block(info, blk); + newblk = blk; + } else { + newblk = get_slot(info); + newblk->start = blk->start; + newblk->size = size; - return start; + /* blk still in free list, with updated start, size */ + blk->start += size; + blk->size -= size; } - newblk = get_slot(info); - newblk->start = blk->start; - newblk->size = size; newblk->owner = owner; - - /* blk still in free list, with updated start, size */ - blk->start += size; - blk->size -= size; - start = newblk->start; - attach_taken_block(info, newblk); /* for larger alignment return fixed up pointer */ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html