Sometimes the input from user may cause an unexpected result.
for example, echo "1-3," > /proc/irq/<xxx>/smp_affinity_list. The correct result should be 1-3, however we got 0-4. To avoid this issue, we check if there is a ready digit. If no valid digit is set, we just continue to the next parse. Signed-off-by: Pan Xinhui <xinhuix....@intel.com> --- lib/bitmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bitmap.c b/lib/bitmap.c index 64c0926..3c489c1 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -561,6 +561,8 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, return -EINVAL; if (b >= nmaskbits) return -ERANGE; + if (unlikely(exp_digit)) + continue; while (a <= b) { set_bit(a, maskp); a++; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/