From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 07:29:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6EB6CE91; Fri, 8 Feb 2013 07:29:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4DEA4920; Fri, 8 Feb 2013 07:29:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r187T8xk093150; Fri, 8 Feb 2013 07:29:08 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r187T82h093149; Fri, 8 Feb 2013 07:29:08 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302080729.r187T82h093149@svn.freebsd.org> From: Andriy Gapon Date: Fri, 8 Feb 2013 07:29:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246530 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 07:29:08 -0000 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; }