mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
dma-mapping: don't trace the DMA address when the allocation fails
dma_alloc_attrs() passes *dma_handle to trace_dma_alloc() without checking whether the allocation succeeded. No backend writes it on failure: dma_direct_alloc(), iommu_dma_alloc() and the dma_map_ops instances assign it only on the path that returns a buffer. Callers usually pass an uninitialized automatic variable, so a failed allocation records whatever the stack held, next to the virt_addr=(null) that marks the record as an error: dma_alloc: dmatrace dir=BIDIRECTIONAL dma_addr=deadbeefdeadbeef size=1099511627776 virt_addr=0000000000000000 The device coherent pool path reaches the same call: a non-zero return from dma_alloc_from_dev_coherent() means the request was handled, not that it succeeded, so cpu_addr is NULL and dma_handle is untouched once the pool runs out. For an allocation event a NULL virt_addr already means the request failed, so the address field carries nothing. Report 0 for it in the event class rather than at each call site, which covers dma_alloc_pages() and dma_alloc_sgt_err() as well. Fixes:038eb433dc("dma-mapping: add tracing for dma-mapping API calls") Fixes:68b6dbf1f4("dma-mapping: trace more error paths") Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com> Link: https://lore.kernel.org/r/20260907120124.603373-1-donggeunyoo.kernel@gmail.com Reviewed-by: Sean Anderson <sean.anderson@linux.dev> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
This commit is contained in:
parent
b7d7914a9a
commit
92c6a8d647
|
|
@ -134,7 +134,7 @@ DECLARE_EVENT_CLASS(dma_alloc_class,
|
|||
TP_fast_assign(
|
||||
__assign_str(device);
|
||||
__entry->virt_addr = virt_addr;
|
||||
__entry->dma_addr = dma_addr;
|
||||
__entry->dma_addr = virt_addr ? dma_addr : 0;
|
||||
__entry->size = size;
|
||||
__entry->flags = flags;
|
||||
__entry->dir = dir;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user