Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752804Ab0KFSrF (ORCPT ); Sat, 6 Nov 2010 14:47:05 -0400 Received: from netrider.rowland.org ([192.131.102.5]:44432 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751828Ab0KFSrD (ORCPT ); Sat, 6 Nov 2010 14:47:03 -0400 Date: Sat, 6 Nov 2010 14:47:02 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: David Brownell cc: Vasiliy Kulikov , , Greg Kroah-Hartman , Oliver Neukum , Andi Kleen , Chris Frey , , Subject: Re: [PATCH] usb: core: fix information leak to userland In-Reply-To: <502882.59497.qm@web180306.mail.gq1.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1461 Lines: 38 On Sat, 6 Nov 2010, David Brownell wrote: > --- On Sat, 11/6/10, Alan Stern 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/