On Mon, 14 Apr 2014, Ezequiel Garcia wrote:

> On Apr 14, Alan Stern wrote:
> > On Mon, 14 Apr 2014, Ezequiel Garcia wrote:
> > 
> > > Currently stk1160_read_reg() uses a stack-allocated char to get the
> > > read control value. This is wrong because usb_control_msg() requires
> > > a kmalloc-ed buffer, and a DMA-API warning is produced:
> > > 
> > > WARNING: CPU: 0 PID: 1376 at lib/dma-debug.c:1153 
> > > check_for_stack+0xa0/0x100()
> > > ehci-pci 0000:00:0a.0: DMA-API: device driver maps memory fromstack 
> > > [addr=ffff88003d0b56bf]
> > > 
> > > This commit fixes such issue by using a 'usb_ctrl_read' field embedded
> > > in the device's struct to pass the value. In addition, we introduce a
> > > mutex to protect the value.
> > 
> > This isn't right either.  The buffer must be allocated in its own cache
> > line; it must not be part of a larger structure.
> > 
> 
> In that case, we can simply allocate 1 byte using kmalloc(). We won't
> be needing the mutex and it'll ensure proper cache alignment, right?

Yes, that will work fine.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to