]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bitmap: fix find helper documentation
authorYury Norov <ynorov@nvidia.com>
Thu, 21 May 2026 16:03:45 +0000 (12:03 -0400)
committerYury Norov <ynorov@nvidia.com>
Thu, 28 May 2026 15:36:59 +0000 (11:36 -0400)
find_nth_and_bit() and find_nth_and_andnot_bit() may return a value
greater than @size when the requested bit does not exist, matching
find_nth_bit(). Document that correctly. All current users are safe
against the '>=' vs '==' conditions.

Also fix the for_each_clear_bitrange_from() parameter descriptions so
they describe clear ranges instead of set ranges.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
include/linux/find.h

index 6c2be8ca615dfba78bbbf6f54d2dd1eb17642577..a129f8205fb6c6698db29195b841f353462b73d3 100644 (file)
@@ -249,7 +249,7 @@ unsigned long find_nth_bit(const unsigned long *addr, unsigned long size, unsign
  * @n: The number of set bit, which position is needed, counting from 0
  *
  * Returns the bit number of the N'th set bit.
- * If no such, returns @size.
+ * If no such, returns >= @size.
  */
 static __always_inline
 unsigned long find_nth_and_bit(const unsigned long *addr1, const unsigned long *addr2,
@@ -277,7 +277,7 @@ unsigned long find_nth_and_bit(const unsigned long *addr1, const unsigned long *
  * @n: The number of set bit, which position is needed, counting from 0
  *
  * Returns the bit number of the N'th set bit.
- * If no such, returns @size.
+ * If no such, returns >= @size.
  */
 static __always_inline
 unsigned long find_nth_and_andnot_bit(const unsigned long *addr1,
@@ -655,8 +655,8 @@ unsigned long find_next_bit_le(const void *addr, unsigned
 
 /**
  * for_each_clear_bitrange_from - iterate over all unset bit ranges [b; e)
- * @b: bit offset of start of current bitrange (first set bit); must be initialized
- * @e: bit offset of end of current bitrange (first unset bit)
+ * @b: bit offset of start of current bitrange (first unset bit); must be initialized
+ * @e: bit offset of end of current bitrange (first set bit)
  * @addr: bitmap address to base the search on
  * @size: bitmap size in number of bits
  */