Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354Ab0DQOmT (ORCPT ); Sat, 17 Apr 2010 10:42:19 -0400 Received: from netrider.rowland.org ([192.131.102.5]:41332 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751920Ab0DQOmS (ORCPT ); Sat, 17 Apr 2010 10:42:18 -0400 Date: Sat, 17 Apr 2010 10:42:17 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Michal Nazarewicz cc: linux-usb@vger.kernel.org, , Greg Kroah-Hartman Subject: Re: [PATCH] usb: core: config.c: use buffer on stack rather then on heap In-Reply-To: <871veecl05.fsf@erwin.mina86.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 751 Lines: 18 On Sat, 17 Apr 2010, Michal Nazarewicz wrote: > usb_get_configuration() uses a temporary buffer allocated on heap > to read USB configuration descriptor. The buffer is just nine > bytes an so it is a waste to allocate it on heap where it can be > allocated on stack with the rest of local variables. This > simplifies the code and minimises memory usage. This is completely wrong. You are not allowed to do DMA to buffers on the stack; some architectures are not capable of handling it. 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/