From: David Woodhouse <d...@amazon.co.uk> Remove a ternary operator that made my brain hurt.
Replace it with something simpler that makes it somewhat clearer that the check for initrdidx < mbi->mods_count is because larger values are what find_first_bit() will return when it doesn't find anything. Also drop the explicit check for module #0 since that would be the dom0 kernel and the corresponding bit is always clear in module_map. Signed-off-by: David Woodhouse <d...@amazon.co.uk> Acked-by: Julien Grall <jul...@xen.org> --- xen/arch/x86/setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index c87040c890..2986cf5a3a 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -688,7 +688,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) char *cmdline, *kextra, *loader; unsigned int initrdidx, num_parked = 0; multiboot_info_t *mbi; - module_t *mod; + module_t *mod, *initrd = NULL; unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1]; int i, j, e820_warn = 0, bytes = 0; bool acpi_boot_table_init_done = false, relocated = false; @@ -1798,6 +1798,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) xen_processor_pmbits |= XEN_PROCESSOR_PM_CX; initrdidx = find_first_bit(module_map, mbi->mods_count); + if ( initrdidx < mbi->mods_count ) + initrd = mod + initrdidx; if ( bitmap_weight(module_map, mbi->mods_count) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", @@ -1822,9 +1824,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) * We're going to setup domain0 using the module(s) that we stashed safely * above our heap. The second module, if present, is an initrd ramdisk. */ - if ( construct_dom0(dom0, mod, modules_headroom, - (initrdidx > 0) && (initrdidx < mbi->mods_count) - ? mod + initrdidx : NULL, cmdline) != 0) + if ( construct_dom0(dom0, mod, modules_headroom, initrd, cmdline) != 0 ) panic("Could not set up DOM0 guest OS\n"); if ( cpu_has_smap )
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel