summaryrefslogtreecommitdiffstats
path: root/sys/ofed/include/linux/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ofed/include/linux/bitops.h')
-rw-r--r--sys/ofed/include/linux/bitops.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/ofed/include/linux/bitops.h b/sys/ofed/include/linux/bitops.h
index f225fdc..d3f82fe 100644
--- a/sys/ofed/include/linux/bitops.h
+++ b/sys/ofed/include/linux/bitops.h
@@ -165,6 +165,8 @@ find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
mask = (*addr) & ~BIT_MASK(offs);
if (mask)
return (bit + __ffsl(mask));
+ if (size - bit <= BITS_PER_LONG)
+ return (size);
bit += BITS_PER_LONG;
addr++;
}
@@ -203,6 +205,8 @@ find_next_zero_bit(unsigned long *addr, unsigned long size,
mask = ~(*addr) & ~BIT_MASK(offs);
if (mask)
return (bit + __ffsl(mask));
+ if (size - bit <= BITS_PER_LONG)
+ return (size);
bit += BITS_PER_LONG;
addr++;
}
OpenPOWER on IntegriCloud