[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+sZ8B9Wrr4yj3c6fiqFhKvZuYifV87EXBQ1pY_Km-p=3oE4ug@mail.gmail.com>
Date: Sat, 4 Feb 2023 15:01:14 +0100
From: Nam Cao <namcaov@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
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 4, 2023 at 2:55 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> 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 :)
Thanks for "the lecture", and sorry for the broken patch.
Best regards,
Nam
Powered by blists - more mailing lists