Commit 59c77efa authored by Yanmin Zhang's avatar Yanmin Zhang Committed by Tony Luck

[IA64] contig.c: Function find_bootmap_location has 2 bugs.

Firstly, if it's done successfully, it should return -1 instead of 1
because its caller, efi_memmap_walk, will end when find_bootmap_location
returns a value smaller than 0.

Secondly, statement "free_start = PAGE_ALIGN(rsvd_region[i].end)" should
been moved forward. free_start needs to be initialized for every loop
iteration.  Current implementation is buggy where initialization is
skipped if range_end <= range_start.  Skipping initializing will leads
to overlapping bootmap with one of the rsvd_regions and subsequently
kernel hang at boot time.
Singed-off-by: default avatar(sic) Zhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: default avatarYao Jun      <junx.yao@intel.com>
Signed-off-by: default avatarTony Luck    <tony.luck@intel.com>
parent 04362c4c
...@@ -116,19 +116,19 @@ find_bootmap_location (unsigned long start, unsigned long end, void *arg) ...@@ -116,19 +116,19 @@ find_bootmap_location (unsigned long start, unsigned long end, void *arg)
range_start = max(start, free_start); range_start = max(start, free_start);
range_end = min(end, rsvd_region[i].start & PAGE_MASK); range_end = min(end, rsvd_region[i].start & PAGE_MASK);
free_start = PAGE_ALIGN(rsvd_region[i].end);
if (range_end <= range_start) if (range_end <= range_start)
continue; /* skip over empty range */ continue; /* skip over empty range */
if (range_end - range_start >= needed) { if (range_end - range_start >= needed) {
bootmap_start = __pa(range_start); bootmap_start = __pa(range_start);
return 1; /* done */ return -1; /* done */
} }
/* nothing more available in this segment */ /* nothing more available in this segment */
if (range_end == end) if (range_end == end)
return 0; return 0;
free_start = PAGE_ALIGN(rsvd_region[i].end);
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment