diff --git a/coverage_config_x86_64.json b/coverage_config_x86_64.json index 27f86931..898d1bf0 100644 --- a/coverage_config_x86_64.json +++ b/coverage_config_x86_64.json @@ -1,5 +1,5 @@ { - "coverage_score": 74.7, + "coverage_score": 74.8, "exclude_path": "", "crate_features": "" } diff --git a/src/loader/x86_64/elf/mod.rs b/src/loader/x86_64/elf/mod.rs index 34ea6092..4b6de40b 100644 --- a/src/loader/x86_64/elf/mod.rs +++ b/src/loader/x86_64/elf/mod.rs @@ -236,10 +236,11 @@ impl KernelLoader for Elf { .read_exact_from(mem_offset, kernel_image, phdr.p_filesz as usize) .map_err(|_| Error::ReadKernelImage)?; - loader_result.kernel_end = mem_offset + let kernel_end = mem_offset .raw_value() .checked_add(phdr.p_memsz as GuestUsize) .ok_or(KernelLoaderError::MemoryOverflow)?; + loader_result.kernel_end = std::cmp::max(loader_result.kernel_end, kernel_end); } // elf image has no setup_header which is defined for bzImage