Skip to content

Commit 4b3fdca

Browse files
joergroedelsuryasaimadhu
authored andcommitted
x86/boot/compressed/64: Check return value of kernel_ident_mapping_init()
The function can fail to create an identity mapping, check for that and bail out if it happens. Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent c2a0304 commit 4b3fdca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/x86/boot/compressed/ident_map_64.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,18 @@ static struct x86_mapping_info mapping_info;
9191
*/
9292
static void add_identity_map(unsigned long start, unsigned long end)
9393
{
94+
int ret;
95+
9496
/* Align boundary to 2M. */
9597
start = round_down(start, PMD_SIZE);
9698
end = round_up(end, PMD_SIZE);
9799
if (start >= end)
98100
return;
99101

100102
/* Build the mapping. */
101-
kernel_ident_mapping_init(&mapping_info, (pgd_t *)top_level_pgt,
102-
start, end);
103+
ret = kernel_ident_mapping_init(&mapping_info, (pgd_t *)top_level_pgt, start, end);
104+
if (ret)
105+
error("Error: kernel_ident_mapping_init() failed\n");
103106
}
104107

105108
/* Locates and clears a region for a new top level page table. */

0 commit comments

Comments
 (0)