ktr: correctly handle possible wrap-around in the boot buffer
Older entries should be 'before' newer entries in the new buffer too and there should be no zero-filled gap between them. Pointed out by: jhb MFC after: 3 days X-MFC with: r246282
This commit is contained in:
parent
1767d529f2
commit
c43b08dc6c
@ -213,7 +213,11 @@ ktr_entries_initializer(void *dummy __unused)
|
||||
ktr_mask = 0;
|
||||
ktr_buf = malloc(sizeof(*ktr_buf) * KTR_ENTRIES, M_KTR,
|
||||
M_WAITOK | M_ZERO);
|
||||
memcpy(ktr_buf, ktr_buf_init, sizeof(ktr_buf_init));
|
||||
memcpy(ktr_buf, ktr_buf_init + ktr_idx,
|
||||
(KTR_BOOT_ENTRIES - ktr_idx) * sizeof(*ktr_buf));
|
||||
if (ktr_idx != 0)
|
||||
memcpy(ktr_buf + KTR_BOOT_ENTRIES - ktr_idx, ktr_buf_init,
|
||||
ktr_idx * sizeof(*ktr_buf));
|
||||
ktr_entries = KTR_ENTRIES;
|
||||
ktr_mask = mask;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user