svn commit: r246530 - head/sys/kern

Andriy Gapon avg at FreeBSD.org
Fri Feb 8 07:29:08 UTC 2013


Author: avg
Date: Fri Feb  8 07:29:07 2013
New Revision: 246530
URL: http://svnweb.freebsd.org/changeset/base/246530

Log:
  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

Modified:
  head/sys/kern/kern_ktr.c

Modified: head/sys/kern/kern_ktr.c
==============================================================================
--- head/sys/kern/kern_ktr.c	Fri Feb  8 03:54:06 2013	(r246529)
+++ head/sys/kern/kern_ktr.c	Fri Feb  8 07:29:07 2013	(r246530)
@@ -213,7 +213,11 @@ ktr_entries_initializer(void *dummy __un
 	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;
 }


More information about the svn-src-all mailing list