mmu: refine function break_page_table

function break_page_table should return next_level_page_size, if
something wrong, it return 0.

the change is valid for release version, as at that time ASSERT()
in break_page_table is empty.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jason Chen CJ 2018-04-05 08:16:38 +08:00 committed by Jack Ren
parent 6454c7be6b
commit cbcc7c0db3

View File

@ -787,12 +787,12 @@ static uint64_t break_page_table(struct map_params *map_params, void *paddr,
/* New entry present - need to allocate a new table */
sub_tab_addr = alloc_paging_struct();
/* Check to ensure memory available for this structure */
if (sub_tab_addr == 0) {
if (sub_tab_addr == NULL) {
/* Error:
* Unable to find table memory necessary to map memory
*/
pr_err("Fail to find table memory for map memory");
ASSERT(sub_tab_addr == 0, "");
ASSERT(0, "fail to alloc table memory for map memory");
return 0;
}
@ -900,6 +900,8 @@ static int modify_paging(struct map_params *map_params, void *paddr,
*/
page_size = break_page_table(map_params,
paddr, vaddr, page_size, direct);
if (page_size == 0)
return -EINVAL;
}
} else {
page_size = ((uint64_t)remaining_size < page_size)