mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02: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 <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
d76181dfab
commit
12373ea918
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user