The patch titled Subject: lib/bitmap.c: fix a special string handling bug in __bitmap_parselist has been added to the -mm tree. Its filename is lib-bitmapc-fix-a-special-string-handling-bug-in-__bitmap_parselist.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-bitmapc-fix-a-special-string-handling-bug-in-__bitmap_parselist.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-bitmapc-fix-a-special-string-handling-bug-in-__bitmap_parselist.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/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Pan Xinhui <xinhuix.pan@xxxxxxxxx> Subject: lib/bitmap.c: fix a special string handling bug in __bitmap_parselist If string end with '-', for exapmle, bitmap_parselist("1,0-",&mask, nmaskbits), It is not in a valid pattern, so add a check after loop. Return -EINVAL on such condition. Signed-off-by: Pan Xinhui <xinhuix.pan@xxxxxxxxx> Cc: Yury Norov <yury.norov@xxxxxxxxx> Cc: Chris Metcalf <cmetcalf@xxxxxxxxxx> Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Cc: Sudeep Holla <sudeep.holla@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/bitmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff -puN lib/bitmap.c~lib-bitmapc-fix-a-special-string-handling-bug-in-__bitmap_parselist lib/bitmap.c --- a/lib/bitmap.c~lib-bitmapc-fix-a-special-string-handling-bug-in-__bitmap_parselist +++ a/lib/bitmap.c @@ -546,6 +546,7 @@ static int __bitmap_parselist(const char return -EINVAL; b = 0; in_range = 1; + at_start = 1; continue; } @@ -558,6 +559,9 @@ static int __bitmap_parselist(const char at_start = 0; totaldigits++; } + /* if no digit is after '-', it's wrong*/ + if (at_start && in_range) + return -EINVAL; if (!(a <= b)) return -EINVAL; if (b >= nmaskbits) _ Patches currently in -mm which might be from xinhuix.pan@xxxxxxxxx are lib-bitmapc-correct-a-code-style-and-do-some-optimization.patch lib-bitmapc-fix-a-special-string-handling-bug-in-__bitmap_parselist.patch lib-bitmapc-bitmap_parselist-can-accept-string-with-whitespaces-on-head-or-tail.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html