The patch titled Subject: lib-rework-bitmap_parselist-v5 has been added to the -mm tree. Its filename is lib-rework-bitmap_parselist-v5.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-rework-bitmap_parselist-v5.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-rework-bitmap_parselist-v5.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-rework-bitmap_parselist-v5 Link: http://lkml.kernel.org/r/20190416063801.20134-3-ynorov@xxxxxxxxxxx Signed-off-by: Yury Norov <ynorov@xxxxxxxxxxx> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Mike Travis <travis@xxxxxxx> Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Cc: Yury Norov <yury.norov@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/bitmap.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) --- a/lib/bitmap.c~lib-rework-bitmap_parselist-v5 +++ a/lib/bitmap.c @@ -20,6 +20,8 @@ #include <asm/page.h> +#include "kstrtox.h" + /** * DOC: bitmap introduction * @@ -515,22 +517,17 @@ static int bitmap_check_region(const str static const char *bitmap_getnum(const char *str, unsigned int *num) { - unsigned int n = 0, _num = 0; + unsigned long long n; + unsigned int len; - if (!isdigit(*str)) + len = _parse_integer(str, 10, &n); + if (!len) return ERR_PTR(-EINVAL); + if (len & KSTRTOX_OVERFLOW || n != (unsigned int)n) + return ERR_PTR(-EOVERFLOW); - for (; isdigit(*str); str++) { - _num = _num * 10 + (*str - '0'); - if (_num < n) - return ERR_PTR(-EOVERFLOW); - - n = _num; - } - - *num = _num; - - return str; + *num = n; + return str + len; } static inline bool end_of_str(char c) _ Patches currently in -mm which might be from ynorov@xxxxxxxxxxx are lib-rework-bitmap_parselist-v5.patch lib-test_bitmap-add-testcases-for-bitmap_parselist-v5.patch cpumask-fix-double-string-traverse-in-cpumask_parse.patch