From owner-svn-src-head@FreeBSD.ORG Tue Jun 16 20:19:01 2015 Return-Path: Delivered-To: svn-src-head@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E976224; Tue, 16 Jun 2015 20:19:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CBBAC5F; Tue, 16 Jun 2015 20:19:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5GKJ19N076203; Tue, 16 Jun 2015 20:19:01 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5GKJ1Vi076201; Tue, 16 Jun 2015 20:19:01 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201506162019.t5GKJ1Vi076201@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 16 Jun 2015 20:19:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284462 - 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.20 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: Tue, 16 Jun 2015 20:19:01 -0000 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);