Commit 4b3fdca6 authored by Joerg Roedel's avatar Joerg Roedel Committed by Borislav Petkov

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: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200907131613.12703-22-joro@8bytes.org
parent c2a0304a
...@@ -91,6 +91,8 @@ static struct x86_mapping_info mapping_info; ...@@ -91,6 +91,8 @@ static struct x86_mapping_info mapping_info;
*/ */
static void add_identity_map(unsigned long start, unsigned long end) static void add_identity_map(unsigned long start, unsigned long end)
{ {
int ret;
/* Align boundary to 2M. */ /* Align boundary to 2M. */
start = round_down(start, PMD_SIZE); start = round_down(start, PMD_SIZE);
end = round_up(end, PMD_SIZE); end = round_up(end, PMD_SIZE);
...@@ -98,8 +100,9 @@ static void add_identity_map(unsigned long start, unsigned long end) ...@@ -98,8 +100,9 @@ static void add_identity_map(unsigned long start, unsigned long end)
return; return;
/* Build the mapping. */ /* Build the mapping. */
kernel_ident_mapping_init(&mapping_info, (pgd_t *)top_level_pgt, ret = kernel_ident_mapping_init(&mapping_info, (pgd_t *)top_level_pgt, start, end);
start, end); if (ret)
error("Error: kernel_ident_mapping_init() failed\n");
} }
/* Locates and clears a region for a new top level page table. */ /* Locates and clears a region for a new top level page table. */
......
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