[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <558E4462.7060600@intel.com>
Date: Sat, 27 Jun 2015 14:36:18 +0800
From: Pan Xinhui <xinhuix.pan@...el.com>
To: linux-kernel@...r.kernel.org
CC: akpm@...ux-foundation.org, linux@...musvillemoes.dk, tj@...nel.org,
mnipxh@....com
Subject: [PATCH] lib/bitmap.c: add some check to correct the parse result
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.pan@...el.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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists