aboutsummaryrefslogtreecommitdiffstats
path: root/lib/find_next_bit.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/find_next_bit.c')
-rw-r--r--lib/find_next_bit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
index c093ba988003..7667c3d907d3 100644
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -185,15 +185,16 @@ static inline unsigned long ext2_swab(const unsigned long y)
185#endif 185#endif
186} 186}
187 187
188unsigned long find_next_zero_bit_le(const unsigned long *addr, unsigned 188unsigned long find_next_zero_bit_le(const void *addr, unsigned
189 long size, unsigned long offset) 189 long size, unsigned long offset)
190{ 190{
191 const unsigned long *p = addr + BITOP_WORD(offset); 191 const unsigned long *p = addr;
192 unsigned long result = offset & ~(BITS_PER_LONG - 1); 192 unsigned long result = offset & ~(BITS_PER_LONG - 1);
193 unsigned long tmp; 193 unsigned long tmp;
194 194
195 if (offset >= size) 195 if (offset >= size)
196 return size; 196 return size;
197 p += BITOP_WORD(offset);
197 size -= result; 198 size -= result;
198 offset &= (BITS_PER_LONG - 1UL); 199 offset &= (BITS_PER_LONG - 1UL);
199 if (offset) { 200 if (offset) {
@@ -228,15 +229,16 @@ found_middle_swap:
228} 229}
229EXPORT_SYMBOL(find_next_zero_bit_le); 230EXPORT_SYMBOL(find_next_zero_bit_le);
230 231
231unsigned long find_next_bit_le(const unsigned long *addr, unsigned 232unsigned long find_next_bit_le(const void *addr, unsigned
232 long size, unsigned long offset) 233 long size, unsigned long offset)
233{ 234{
234 const unsigned long *p = addr + BITOP_WORD(offset); 235 const unsigned long *p = addr;
235 unsigned long result = offset & ~(BITS_PER_LONG - 1); 236 unsigned long result = offset & ~(BITS_PER_LONG - 1);
236 unsigned long tmp; 237 unsigned long tmp;
237 238
238 if (offset >= size) 239 if (offset >= size)
239 return size; 240 return size;
241 p += BITOP_WORD(offset);
240 size -= result; 242 size -= result;
241 offset &= (BITS_PER_LONG - 1UL); 243 offset &= (BITS_PER_LONG - 1UL);
242 if (offset) { 244 if (offset) {