From owner-freebsd-current@FreeBSD.ORG Wed Jun 17 04:24:49 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 278DB1065674; Wed, 17 Jun 2009 04:24:49 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id C854F8FC19; Wed, 17 Jun 2009 04:24:48 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender; b=dSYd6N+3cP+bV2i0yCsDOBrxqcI/XOACtGZvEpIx0DCyVA+S9s+4P96hDxFsFJRGgAMl/JhbpKv/ViZfnesJkGIuh0t3wwyZkMVwjGC0/CpmpCgsQJ5vpS5Wk2s1u/b/hDKmA7EvirmQ2WauIzMQyQNIYsJJ1UQIOSL+APQRnfU=; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1MGmhb-000643-If; Wed, 17 Jun 2009 08:24:47 +0400 Date: Wed, 17 Jun 2009 08:24:44 +0400 From: Eygene Ryabinkin To: Marius Strobl Message-ID: References: <20090602222445.2F6017302F@freebsd-current.sentex.ca> <20090603200013.GB43137@alchemy.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090603200013.GB43137@alchemy.franken.de> Sender: rea-fbsd@codelabs.ru Cc: current@freebsd.org, rwatson@freebsd.org, FreeBSD Tinderbox , sparc64@freebsd.org, kmacy@freebsd.org Subject: Re: [head tinderbox] failure on sparc64/sun4v X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rea-fbsd@codelabs.ru List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 04:24:50 -0000 Marius, *, good day. Wed, Jun 03, 2009 at 10:00:13PM +0200, Marius Strobl wrote: > On Wed, Jun 03, 2009 at 02:15:55PM +0400, Eygene Ryabinkin wrote: > > And while I am here: definition for PCPU_NAME_LEN seems to be wrong. > > It is intended to fit ("CPU %d", cpuid) where cpuid <= MAXCPU. If this > > is correct, then (sys/sys/pcpu.h, line 57) > > > > 1. sizeof(__XSTRING(MAXCPU) + 1) is a typo: typeof(__XSTRING(...) + 1) > > is 'char *', so sizeof() will return the size of the pointer, not > > the size of the string contents. The proper expression should be > > 'sizeof(__XSTRING(MAXCPU)) + 1'. > > > > 2. one should not add one, but substract it: sizeof() accounts for the > > trailing '\0' and we have two sizeof's, so the size of one '\0' > > should be substracted -- this will give the maximal string buffer > > length for CPU with its number, no less, no more. > > > > Does the attached patch looks sane? > > diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h > > index 63c3fa3..98705eb 100644 > > --- a/sys/sys/pcpu.h > > +++ b/sys/sys/pcpu.h > > @@ -54,7 +54,7 @@ struct rm_queue { > > struct rm_queue* volatile rmq_prev; > > }; > > > > -#define PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__XSTRING(MAXCPU) + 1)) > > +#define PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__XSTRING(MAXCPU)) - 1) > > > > > > /* > > This looks correct to me. Jeff? Any updates on this matter? May be someone else will be able to review the patch? Kip, Robert? -- Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook {_.-``-' {_/ #