mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
s390/boot: Bound command line facility ranges
The facilities and debug-alternative command line parsers iterate over inclusive numeric ranges. If a range ends at ULONG_MAX, incrementing the current value wraps to zero and the loop never terminates. Large finite out-of-range values also cause unnecessary early boot iterations even though the bitmap helpers ignore them. Stop each loop at the size of the bitmap it modifies. This preserves all meaningful range values while guaranteeing termination. Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
This commit is contained in:
1 parent
d76181dfab
commit
12373ea918
2 files changed
+4
-3
No files matched your search
@@ -45,11 +45,12 @@ static void alt_debug_modify(int type, unsigned int nr, bool clear)
|
||||
|
||||
static char *alt_debug_parse(int type, char *str)
|
||||
{
|
||||
unsigned long val, endval;
|
||||
unsigned long val, endval, limit;
|
||||
char *endp;
|
||||
bool clear;
|
||||
int i;
|
||||
|
||||
limit = type == ALT_TYPE_FACILITY ? MAX_FACILITY_BIT : MAX_MFEATURE_BIT;
|
||||
if (*str == ':') {
|
||||
str++;
|
||||
} else {
|
||||
@@ -73,7 +74,7 @@ static char *alt_debug_parse(int type, char *str)
|
||||
if (str == endp)
|
||||
break;
|
||||
str = endp;
|
||||
while (val <= endval) {
|
||||
while (val <= endval && val < limit) {
|
||||
alt_debug_modify(type, val, clear);
|
||||
val++;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ static void modify_fac_list(char *str)
|
||||
if (str == endp)
|
||||
break;
|
||||
str = endp;
|
||||
while (val <= endval) {
|
||||
while (val <= endval && val < MAX_FACILITY_BIT) {
|
||||
modify_facility(val, clear);
|
||||
val++;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user