summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2014-03-22 22:35:57 +0000
committerneel <neel@FreeBSD.org>2014-03-22 22:35:57 +0000
commita2b3b7f5fa951e4a4122c1fc5b05fab3b6bf3760 (patch)
tree2838a637a499b46fc001973a33795e8f9710effe
parent755aabe3d20901f54daba9084d265405c6f92b5c (diff)
downloadFreeBSD-src-a2b3b7f5fa951e4a4122c1fc5b05fab3b6bf3760.zip
FreeBSD-src-a2b3b7f5fa951e4a4122c1fc5b05fab3b6bf3760.tar.gz
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'.
-rw-r--r--sys/kern/kern_ktr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c
index 428afae..e302ae2 100644
--- a/sys/kern/kern_ktr.c
+++ b/sys/kern/kern_ktr.c
@@ -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;
}
OpenPOWER on IntegriCloud