Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jul 2011 16:29:37 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Craig Rodrigues <rodrigc@crodrigues.org>
Cc:        Tai-hwa Liang <avatar@freebsd.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r223854 - head/lib/libstand
Message-ID:  <B8307588-78BB-401B-9CCB-9032727D6EF5@bsdimp.com>
In-Reply-To: <CAG=rPVcydzGwfxVS6mbJs6eka52btsf=c5ZtKnkOEgPk-UZSpw@mail.gmail.com>
References:  <201107080135.p681ZXZu087112@svn.freebsd.org> <CAG=rPVcydzGwfxVS6mbJs6eka52btsf=c5ZtKnkOEgPk-UZSpw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jul 8, 2011, at 2:25 AM, Craig Rodrigues wrote:

> Hi,
>=20
> While not ideal, would it be possible consider setting WARNS to set =
different levels
> depending on what the value of ${MACHINE_ARCH} is?
>=20
> Something like:
>=20
> .if ${MACHINE_ARCH} !=3D "sparc64"  (or whatever the correct value is)
> WARNS ?=3D 0
> .else
> WARNS ?=3D 2
> .endif
>=20
> This would at least be an attempt to prevent people from adding new
> code to libstand which introduce new warnings.

We've avoided this in the tree, and I'd urge against it.  It gives a =
false sense of security and tends to make problems linger.  I'd like to =
strongly argue against it.

Warner

> --
> Craig Rodrigues
> rodrigc@crodrigues.org
>=20
> On Thu, Jul 7, 2011 at 6:35 PM, Tai-hwa Liang <avatar@freebsd.org> =
wrote:
> Author: avatar
> Date: Fri Jul  8 01:35:33 2011
> New Revision: 223854
> URL: http://svn.freebsd.org/changeset/base/223854
>=20
> Log:
>  Fixing building bustage on 32 bits platforms when WARNS >=3D 2.  Note =
that
>  this fix only applies to zalloc.c, the other part of libstand such =
like
>  qdivrem.c still gives compilation warnings on sparc64 tinderbox =
builds;
>  therefore, WARNS level isn't changed for now.
>=20
>  Submitted by: Garrett Cooper <yanegomi@gmail.com>
>  Reviewed by:  bde
>=20
> Modified:
>  head/lib/libstand/zalloc.c
>  head/lib/libstand/zalloc_defs.h
>=20
> Modified: head/lib/libstand/zalloc.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/lib/libstand/zalloc.c  Fri Jul  8 01:32:04 2011        =
(r223853)
> +++ head/lib/libstand/zalloc.c  Fri Jul  8 01:35:33 2011        =
(r223854)
> @@ -154,7 +154,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
>     if ((char *)ptr < (char *)mp->mp_Base ||
>        (char *)ptr + bytes > (char *)mp->mp_End ||
>        ((iaddr_t)ptr & MEMNODE_SIZE_MASK) !=3D 0)
> -       panic("zfree(%p,%ju): wild pointer", ptr, bytes);
> +       panic("zfree(%p,%ju): wild pointer", ptr, (uintmax_t)bytes);
>=20
>     /*
>      * free the segment
> @@ -177,8 +177,10 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
>                /*
>                 * range check
>                 */
> -               if ((char *)ptr + bytes > (char *)mn)
> -                   panic("zfree(%p,%ju): corrupt memlist1",ptr, =
bytes);
> +               if ((char *)ptr + bytes > (char *)mn) {
> +                   panic("zfree(%p,%ju): corrupt memlist1", ptr,
> +                       (uintmax_t)bytes);
> +               }
>=20
>                /*
>                 * merge against next area or create independant area
> @@ -208,8 +210,10 @@ zfree(MemPool *mp, void *ptr, iaddr_t by
>                return;
>                /* NOT REACHED */
>            }
> -           if ((char *)ptr < (char *)mn + mn->mr_Bytes)
> -               panic("zfree(%p,%ju): corrupt memlist2", ptr, bytes);
> +           if ((char *)ptr < (char *)mn + mn->mr_Bytes) {
> +               panic("zfree(%p,%ju): corrupt memlist2", ptr,
> +                   (uintmax_t)bytes);
> +           }
>        }
>        /*
>         * We are beyond the last MemNode, append new MemNode.  Merge =
against
>=20
> Modified: head/lib/libstand/zalloc_defs.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/lib/libstand/zalloc_defs.h     Fri Jul  8 01:32:04 2011       =
 (r223853)
> +++ head/lib/libstand/zalloc_defs.h     Fri Jul  8 01:35:33 2011       =
 (r223854)
> @@ -39,6 +39,7 @@
>  #define ZALLOCDEBUG
>=20
>  #include <string.h>
> +#include <sys/stdint.h>
>  #include "stand.h"
>=20
>  typedef uintptr_t iaddr_t;     /* unsigned int same size as pointer   =
 */
>=20
>=20
>=20
> --=20
> Craig Rodrigues
> rodrigc@rodrigues.org
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B8307588-78BB-401B-9CCB-9032727D6EF5>