Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Feb 2016 21:43:48 -0600
From:      Benjamin Kaduk <bjkfbsd@gmail.com>
To:        cem@freebsd.org
Cc:        Gleb Smirnoff <glebius@freebsd.org>, Alan Somers <asomers@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, Sergey Kandaurov <pluknet@gmail.com>,  "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r295768 - head/usr.sbin/iostat
Message-ID:  <CAJ5_RoA5mOFoi30H-yDLu-JwMHc%2Bxc=_iAcGOSx9CuL_800RDg@mail.gmail.com>
In-Reply-To: <CAG6CVpUDWjSF6ht1hHKXp0PPh-H6zg51tace8=m0DEqdOrWGSA@mail.gmail.com>
References:  <201602182008.u1IK81vg092127@repo.freebsd.org> <CAE-mSO%2B7p=Equq81PPQjfZv1piPydBr4Mnk363CEs3w9EXRi9w@mail.gmail.com> <CAOtMX2hyZ=GFgp8F6t0dMDYF5FSPdoP9KdMU7V5rmscpaPUnsw@mail.gmail.com> <20160219230612.GR1945@FreeBSD.org> <CAJ5_RoCbWLUkwdRv4FeFVGpzCENooJbokH0SNXtiCeoRSeW%2BfQ@mail.gmail.com> <CAG6CVpUDWjSF6ht1hHKXp0PPh-H6zg51tace8=m0DEqdOrWGSA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 19, 2016 at 6:50 PM, Conrad Meyer <cem@freebsd.org> wrote:

> On Fri, Feb 19, 2016 at 3:14 PM, Benjamin Kaduk <bjkfbsd@gmail.com> wrote:
> > On Fri, Feb 19, 2016 at 5:06 PM, Gleb Smirnoff <glebius@freebsd.org>
> wrote:
> >> Isn't zero filling part of the standard? I don't see why lack of
> >> explicit zeroing is a warning? Looks a false warning to me.
> >
> >
> > It is not quite as simple as this would make it sound.  The elements or
> > members of an aggregate (e.g.) structure type are initialized as if it
> were
> > an object of static storage duration (i.e., to zero) if the initializer
> list
> > does not contain enough initializers for all members of the aggregate
> type,
> > per item 21 of section 6.7.8 of n1256.pdf.  However, such initialization
> > does not necessarily need to zero any padding bytes that are present,
> which
> > may take unspecified values.  Personally, I think this particular clang
> > warning can be too aggressive, especially for complex structs, but on the
> > other hand given the indeterminateness of padding, bzero/memset are
> often a
> > better choice anyway.
>
>
> By definition, padding byte contents are unused.  There is no reason
> their values matter one way or another, so why do we care about the
> distinction between bzero and member zero initialization?
>

Well, you can access them by treating the object as an array of char, and
then memory sanitizer will complain about the uninitialized access, as in
https://github.com/openssl/openssl/commit/f0496ad71fbacccf5a95f40d31d251bc8cf9dcfb

-Ben

P.S. Not really apropos of anything, but clang also has -Weverything which
is just what it sounds like (as opposed to -Wall), which is a great way to
expose several other warnings that Bruce will call bugs :)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ5_RoA5mOFoi30H-yDLu-JwMHc%2Bxc=_iAcGOSx9CuL_800RDg>