[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y95jtuMbcDiPRw/F@kroah.com>
Date: Sat, 4 Feb 2023 14:55:02 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Nam Cao <namcaov@...il.com>
Cc: Johan Hovold <johan@...nel.org>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] USB: serial: whiteheat: use stack instead of heap memory
On Sat, Feb 04, 2023 at 02:46:51PM +0100, Nam Cao wrote:
> Some buffers in whiteheat_attach() are small and only used locally. Move
> them to the stack to avoid complications with heap memory.
>
> Compile-tested only.
And that's the problem, you can't just compile test these things, the
code will blow up if you make these changes :(
All USB transfers need to come from memory that can be safely DMAed.
Stack memory is not that type of memory, you HAVE to allocate it
dynamically from the heap in order to have this guarantee.
So no, this patch is not acceptable, sorry. You will see this pattern
in all USB drivers, all data must be dynamically allocated, even for 2
byte commands.
So yes, there was a reason we added this "complexity" to the driver, it
is required :)
sorry,
greg k-h
Powered by blists - more mailing lists