summaryrefslogtreecommitdiff
path: root/include/linux/find.h
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2024-05-02 20:12:56 +0300
committerYury Norov <yury.norov@gmail.com>2024-05-09 19:25:08 +0300
commit0b2811ba11b04353033237359c9d042eb0cdc1c1 (patch)
tree457edbccba4f262f89ac844914158f7705857ff4 /include/linux/find.h
parent77db1920a88103e8ef9ee58130df7c970aea3d17 (diff)
downloadlinux-0b2811ba11b04353033237359c9d042eb0cdc1c1.tar.xz
bitmap: relax find_nth_bit() limitation on return value
The function claims to return the bitmap size, if Nth bit doesn't exist. This rule is violated in inline case because the fns() that is used there doesn't know anything about size of the bitmap. So, relax this requirement to '>= size', and make the outline implementation a bit cheaper. All in-tree kernel users of find_nth_bit() are safe against that. Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Closes: https://lore.kernel.org/all/Zi50cAgR8nZvgLa3@yury-ThinkPad/T/#m6da806a0525e74dcc91f35e5f20766ed4e853e8a Signed-off-by: Yury Norov <yury.norov@gmail.com>
Diffstat (limited to 'include/linux/find.h')
-rw-r--r--include/linux/find.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/find.h b/include/linux/find.h
index c69598e383c1..02751e43d448 100644
--- a/include/linux/find.h
+++ b/include/linux/find.h
@@ -220,7 +220,7 @@ unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
* idx = find_first_bit(addr, size);
*
* Returns the bit number of the N'th set bit.
- * If no such, returns @size.
+ * If no such, returns >= @size.
*/
static inline
unsigned long find_nth_bit(const unsigned long *addr, unsigned long size, unsigned long n)