Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jun 2014 14:49:00 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267162 - head/sys/kern
Message-ID:  <201406061449.s56En06e073028@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Fri Jun  6 14:49:00 2014
New Revision: 267162
URL: http://svnweb.freebsd.org/changeset/base/267162

Log:
  ktrace: Use designated initializers for the data_lengths array.
  
  In the .o file, this only changes some line numbers (head amd64) because
  element 0 is no longer explicitly initialized.
  
  This should make bugs like FreeBSD-SA-14:12.ktrace less likely.
  
  Discussed with:	des
  MFC after:	1 week

Modified:
  head/sys/kern/kern_ktrace.c

Modified: head/sys/kern/kern_ktrace.c
==============================================================================
--- head/sys/kern/kern_ktrace.c	Fri Jun  6 13:37:40 2014	(r267161)
+++ head/sys/kern/kern_ktrace.c	Fri Jun  6 14:49:00 2014	(r267162)
@@ -109,21 +109,20 @@ struct ktr_request {
 };
 
 static int data_lengths[] = {
-	0,					/* none */
-	offsetof(struct ktr_syscall, ktr_args),	/* KTR_SYSCALL */
-	sizeof(struct ktr_sysret),		/* KTR_SYSRET */
-	0,					/* KTR_NAMEI */
-	sizeof(struct ktr_genio),		/* KTR_GENIO */
-	sizeof(struct ktr_psig),		/* KTR_PSIG */
-	sizeof(struct ktr_csw),			/* KTR_CSW */
-	0,					/* KTR_USER */
-	0,					/* KTR_STRUCT */
-	0,					/* KTR_SYSCTL */
-	sizeof(struct ktr_proc_ctor),		/* KTR_PROCCTOR */
-	0,					/* KTR_PROCDTOR */
-	sizeof(struct ktr_cap_fail),		/* KTR_CAPFAIL */
-	sizeof(struct ktr_fault),		/* KTR_FAULT */
-	sizeof(struct ktr_faultend),		/* KTR_FAULTEND */
+	[KTR_SYSCALL] = offsetof(struct ktr_syscall, ktr_args),
+	[KTR_SYSRET] = sizeof(struct ktr_sysret),
+	[KTR_NAMEI] = 0,
+	[KTR_GENIO] = sizeof(struct ktr_genio),
+	[KTR_PSIG] = sizeof(struct ktr_psig),
+	[KTR_CSW] = sizeof(struct ktr_csw),
+	[KTR_USER] = 0,
+	[KTR_STRUCT] = 0,
+	[KTR_SYSCTL] = 0,
+	[KTR_PROCCTOR] = sizeof(struct ktr_proc_ctor),
+	[KTR_PROCDTOR] = 0,
+	[KTR_CAPFAIL] = sizeof(struct ktr_cap_fail),
+	[KTR_FAULT] = sizeof(struct ktr_fault),
+	[KTR_FAULTEND] = sizeof(struct ktr_faultend),
 };
 
 static STAILQ_HEAD(, ktr_request) ktr_free;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406061449.s56En06e073028>