Skip to content
Snippets Groups Projects
Commit dd5d5d77 authored by Partha Susarla's avatar Partha Susarla
Browse files

[boot] A trivial patch that checks `mod_count` before using it.

This patch just reorders the code, to actually do the check if there are any
modules (represented by `mod_count`) before any setup or lookup is done.
parent f186c71b
No related branches found
No related tags found
No related merge requests found
......@@ -424,6 +424,12 @@ try_boot_sys(
}
printf("Detected %d boot module(s):\n", mbi->mod_count);
if (mbi->mod_count < 1) {
printf("Expect at least one boot module (containing a userland image)\n");
return false;
}
mods_end_paddr = 0;
for (i = 0; i < mbi->mod_count; i++) {
......@@ -446,11 +452,6 @@ try_boot_sys(
mods_end_paddr = ROUND_UP(mods_end_paddr, PAGE_BITS);
assert(mods_end_paddr > boot_state.ki_p_reg.end);
if (mbi->mod_count < 1) {
printf("Expect at least one boot module (containing a userland image)\n");
return false;
}
printf("ELF-loading userland images from boot modules:\n");
load_paddr = mods_end_paddr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment