Date: Fri, 8 Feb 2013 07:29:08 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246530 - head/sys/kern Message-ID: <201302080729.r187T82h093149@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302080729.r187T82h093149>