mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-01 11:54:10 +00:00
early_res: Need to save the allocation name in drop_range_partial()
During free_early_partial(), reserve_early_without_check() could end extending the early_res area from __check_and_double_early_res(); as a result, the location of the name for the current reservation could change. Therefore, we need to save a local copy of the name. [ hpa: rewrote comment and checkin description ] Signed-off-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <4B8C7C94.7070000@kernel.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
81d0d950e5
commit
dce46a04d5
1 changed files with 12 additions and 2 deletions
|
@ -79,9 +79,19 @@ static void __init drop_range_partial(int i, u64 start, u64 end)
|
||||||
/* make head segment */
|
/* make head segment */
|
||||||
early_res[i].end = common_start;
|
early_res[i].end = common_start;
|
||||||
if (old_end > common_end) {
|
if (old_end > common_end) {
|
||||||
|
char name[15];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save a local copy of the name, since the
|
||||||
|
* early_res array could get resized inside
|
||||||
|
* reserve_early_without_check() ->
|
||||||
|
* __check_and_double_early_res(), which would
|
||||||
|
* make the current name pointer invalid.
|
||||||
|
*/
|
||||||
|
strncpy(name, early_res[i].name,
|
||||||
|
sizeof(early_res[i].name) - 1);
|
||||||
/* add another for left over on tail */
|
/* add another for left over on tail */
|
||||||
reserve_early_without_check(common_end, old_end,
|
reserve_early_without_check(common_end, old_end, name);
|
||||||
early_res[i].name);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue