if lapic_create is passed the value 16, it will use it as index into lapics, with potentially bad results. the check should be if (apic_id >= MAX_APICID).