Re: [head tinderbox] failure on sparc64/sun4v

From: Eygene Ryabinkin <rea-fbsd_at_codelabs.ru>
Date: Wed, 17 Jun 2009 08:24:44 +0400
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
> > _at__at_ -54,7 +54,7 _at__at_ 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
    {_.-``-'         {_/            #
Received on Wed Jun 17 2009 - 02:24:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:50 UTC