Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kirjanov <dkirjanov@suse.com>2019-08-01 12:26:03 +0300
committerDenis Kirjanov <dkirjanov@suse.com>2019-08-01 12:26:03 +0300
commitf51cf6df44b7a59b19bde3f11097f78cb01eb101 (patch)
treecf60e0e390f3a398d9b3b70bb4baea4880847285
parentf81a69a442e2cbac261ad8dda0a76b26d8ee014f (diff)
parent1d213c726412d08fd0d67c87fb45b09cc2c762b0 (diff)
Merge 'users/tiwai/SLE12-SP5/for-next' into SLE12-SP5rpm-4.12.14-105
Pull a fix for __bitmap_parselist from Takashi Iwai suse-commit: 16b2863c28759b63e84a9a6851ca3e94a8ac48af
-rw-r--r--lib/bitmap.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index d99cb0a2ebab..5b476d8414be 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -516,7 +516,7 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
int nmaskbits)
{
unsigned int a, b, old_a, old_b;
- unsigned int group_size, used_size;
+ unsigned int group_size, used_size, off;
int c, old_c, totaldigits, ndigits;
const char __user __force *ubuf = (const char __user __force *)buf;
int at_start, in_range, in_partial_range;
@@ -602,6 +602,8 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
a = old_a;
b = old_b;
old_a = old_b = 0;
+ } else {
+ used_size = group_size = b - a + 1;
}
/* if no digit is after '-', it's wrong*/
if (at_start && in_range)
@@ -611,17 +613,9 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
if (b >= nmaskbits)
return -ERANGE;
while (a <= b) {
- if (in_partial_range) {
- static int pos_in_group = 1;
-
- if (pos_in_group <= used_size)
- set_bit(a, maskp);
-
- if (a == b || ++pos_in_group > group_size)
- pos_in_group = 1;
- } else
- set_bit(a, maskp);
- a++;
+ off = min(b - a + 1, used_size);
+ bitmap_set(maskp, a, off);
+ a += group_size;
}
} while (buflen && c == ',');
return 0;