From 3960f2faaf0a67ad352bd5d4085e43f19f33ab91 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Tue, 10 Jan 2006 17:00:39 +1000 Subject: [PATCH] [PATCH] m68knommu: fix find_next_zero_bit in bitops.h We're starting a number of big applications (memory footprint app. 1MByte) on our Arcturus uC5272. Therefore memory fragmentation is a real pain for us. We've switched to uClinux-2.4.27-uc1 and found that page_alloc2 fragments the memory heavily. Digging into it we found a bug in the find_next_zero_bit function in the m68knommu/bitops.h file. if the size isn't a multiple of 32 than the upper bits of the last word to be searched should be masked. But the functions masks the lower bits of the last word because it uses a right shift instead of a left shift operator. Patch submitted by Sascha Smejkal Signed-off-by: Greg Ungerer Signed-off-by: Linus Torvalds --- include/asm-m68knommu/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index 4058dd0..25d8a3c 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h @@ -290,7 +290,7 @@ static __inline__ int find_next_zero_bit (const void * addr, int size, int offse tmp = *p; found_first: - tmp |= ~0UL >> size; + tmp |= ~0UL << size; found_middle: return result + ffz(tmp); } -- 1.8.2.3