[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1011061441150.28403-100000@netrider.rowland.org>
Date: Sat, 6 Nov 2010 14:47:02 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: David Brownell <david-b@...bell.net>
cc: Vasiliy Kulikov <segooon@...il.com>,
<kernel-janitors@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
Oliver Neukum <oliver@...kum.org>,
Andi Kleen <ak@...ux.intel.com>,
Chris Frey <cdfrey@...rsquare.net>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: core: fix information leak to userland
On Sat, 6 Nov 2010, David Brownell wrote:
> --- On Sat, 11/6/10, Alan Stern <stern@...land.harvard.edu> wrote:
>
> > Are you sure that adding an initializer
> > like this will zero out the
> > padding bytes? It might be safer just to call
> > memset.
>
> ISTR the C standard says things get initted to
> zero in this case too ... and that compilers will
> as a rule use memset to do it. One could look
> at the generated code to make sure of that.
Unfortunately I don't have a copy of the C standard here to consult.
However... Although I'm perfectly willing to believe that the standard
requires fields in a structure to be initialized to 0 if they
aren't mentioned explicitly in the initializer, I'm considerably more
doubtful that it also requires padding to be initialized!
And I certainly wouldn't want to depend on compilers _always_ using
memset to do this initialization.
> There's certainly a fair amount of code I've seen
> that uses runtime initializers like that, to zero
> memory. I can't believe i's _all_ broken! ;)
Zeroing memory that belongs to a declared field is different from
zeroing padding bytes. Maybe what you remember seeing is the first and
not the second.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists