svn commit: r284462 - head/sys/kern

Pedro F. Giffuni pfg at FreeBSD.org
Tue Jun 16 20:19:01 UTC 2015


Author: pfg
Date: Tue Jun 16 20:19:00 2015
New Revision: 284462
URL: https://svnweb.freebsd.org/changeset/base/284462

Log:
  Use nitems() macro instead of __arraycount()

Modified:
  head/sys/kern/stack_protector.c

Modified: head/sys/kern/stack_protector.c
==============================================================================
--- head/sys/kern/stack_protector.c	Tue Jun 16 20:01:01 2015	(r284461)
+++ head/sys/kern/stack_protector.c	Tue Jun 16 20:19:00 2015	(r284462)
@@ -17,15 +17,14 @@ __stack_chk_fail(void)
 	panic("stack overflow detected; backtrace may be corrupted");
 }
 
-#define __arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
 static void
 __stack_chk_init(void *dummy __unused)
 {
 	size_t i;
-	long guard[__arraycount(__stack_chk_guard)];
+	long guard[nitems(__stack_chk_guard)];
 
 	arc4rand(guard, sizeof(guard), 0);
-	for (i = 0; i < __arraycount(guard); i++)
+	for (i = 0; i < nitems(guard); i++)
 		__stack_chk_guard[i] = guard[i];
 }
 SYSINIT(stack_chk, SI_SUB_RANDOM, SI_ORDER_ANY, __stack_chk_init, NULL);


More information about the svn-src-all mailing list