else
{
initrdidx = find_first_bit(module_map, mbi->mods_count);
+ if ( initrdidx >= mbi->mods_count )
+ initrdidx = 0;
+
if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
printk(XENLOG_WARNING
"Multiple initrd candidates, picking module #%u\n",
* safely above our heap. The second module, if present, is an initrd.
*/
dom0 = create_dom0(mod, modules_headroom,
- (initrdidx > 0) && (initrdidx < mbi->mods_count)
- ? mod + initrdidx : NULL, kextra, loader);
+ initrdidx ? mod + initrdidx : NULL,
+ kextra, loader);
if ( dom0 == NULL )
panic("Could not set up DOM0 guest OS\n");
}