The patch titled Subject: lib: opencode in_str() has been added to the -mm tree. Its filename is lib-rework-bitmap_parse-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-rework-bitmap_parse-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-rework-bitmap_parse-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yury Norov <ynorov@xxxxxxxxxxx> Subject: lib: opencode in_str() Link: http://lkml.kernel.org/r/20190510022633.GA30629@yury-thinkpad Signed-off-by: Yury Norov <ynorov@xxxxxxxxxxx> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Cc: Amritha Nambiar <amritha.nambiar@xxxxxxxxx> Cc: Willem de Bruijn <willemb@xxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: "Tobin C . Harding" <tobin@xxxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Steffen Klassert <steffen.klassert@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/bitmap.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) --- a/lib/bitmap.c~lib-rework-bitmap_parse-fix +++ a/lib/bitmap.c @@ -454,11 +454,6 @@ static inline bool end_of_region(char c) return __end_of_region(c) || end_of_str(c); } -static inline bool in_str(const char *start, const char *ptr) -{ - return start <= ptr; -} - /* * The format allows commas and whitespases at the beginning * of the region. @@ -473,7 +468,7 @@ static const char *bitmap_find_region(co static const char *bitmap_find_region_reverse(const char *start, const char *end) { - while (in_str(start, end) && __end_of_region(*end)) + while (start <= end && __end_of_region(*end)) end--; return end; @@ -618,7 +613,7 @@ static const char *bitmap_get_x32_revers ret |= c << i; - if (!in_str(start, end) || __end_of_region(*end)) + if (start > end || __end_of_region(*end)) goto out; } @@ -653,7 +648,7 @@ int bitmap_parse(const char *start, unsi u32 *bitmap = (u32 *)maskp; int unset_bit; - while (in_str(start, (end = bitmap_find_region_reverse(start, end)))) { + while (start <= (end = bitmap_find_region_reverse(start, end))) { if (!chunks--) return -EOVERFLOW; _ Patches currently in -mm which might be from ynorov@xxxxxxxxxxx are lib-rework-bitmap_parse-fix.patch