Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

From: Wolfram Sang
Date: Wed May 31 2017 - 11:12:44 EST



> > +/* only works in process context because of stack detection */
> > +static inline bool is_dma_capable_addr(void *addr)
> > +{
> > + return !(is_vmalloc_or_module_addr(addr) ||
> > + object_is_on_stack(addr));
>
> This does not catch kmap'ed buffers which are not directly DMA'able.
> I would suggest to use virt_addr_valid() instead. Something like:
>
> return (virt_addr_valid(addr) && !object_is_on_stack(addr));

Hehe, here is the part of the commit message I have for this code:

===

Second note: I am not even sure the checks complete (kmapped mem?). But
that just strengthens the argument of having on centralized place IMO :)

===

So, thanks for the heads up!

Attachment: signature.asc
Description: PGP signature