Don't lose track of the KTR entries copied from 'ktr_buf_init[]' to the

dynamically allocated 'ktr_buf[]'.

The memcpy arranges 'ktr_buf[]' such that the latest KTR entry is at
'KTR_BOOT_ENTRIES - 1'.
This commit is contained in:
Neel Natu 2014-03-22 22:35:57 +00:00
parent 825ab35431
commit d6543c678c

View File

@ -212,9 +212,11 @@ ktr_entries_initializer(void *dummy __unused)
M_WAITOK | M_ZERO);
memcpy(ktr_buf, ktr_buf_init + ktr_idx,
(KTR_BOOT_ENTRIES - ktr_idx) * sizeof(*ktr_buf));
if (ktr_idx != 0)
if (ktr_idx != 0) {
memcpy(ktr_buf + KTR_BOOT_ENTRIES - ktr_idx, ktr_buf_init,
ktr_idx * sizeof(*ktr_buf));
ktr_idx = KTR_BOOT_ENTRIES;
}
ktr_entries = KTR_ENTRIES;
ktr_mask = mask;
}