Skip to content

Commit cbcc7c0

Browse files
JasonChenCJjren1
authored andcommitted
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>
1 parent 6454c7b commit cbcc7c0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hypervisor/arch/x86/mmu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,12 +787,12 @@ static uint64_t break_page_table(struct map_params *map_params, void *paddr,
787787
/* New entry present - need to allocate a new table */
788788
sub_tab_addr = alloc_paging_struct();
789789
/* Check to ensure memory available for this structure */
790-
if (sub_tab_addr == 0) {
790+
if (sub_tab_addr == NULL) {
791791
/* Error:
792792
* Unable to find table memory necessary to map memory
793793
*/
794794
pr_err("Fail to find table memory for map memory");
795-
ASSERT(sub_tab_addr == 0, "");
795+
ASSERT(0, "fail to alloc table memory for map memory");
796796
return 0;
797797
}
798798

@@ -900,6 +900,8 @@ static int modify_paging(struct map_params *map_params, void *paddr,
900900
*/
901901
page_size = break_page_table(map_params,
902902
paddr, vaddr, page_size, direct);
903+
if (page_size == 0)
904+
return -EINVAL;
903905
}
904906
} else {
905907
page_size = ((uint64_t)remaining_size < page_size)

0 commit comments

Comments
 (0)