linux/include/trace
Donggeun Yoo 92c6a8d647 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>
2026-09-09 12:02:33 +02:00
..
events dma-mapping: don't trace the DMA address when the allocation fails 2026-09-09 12:02:33 +02:00
misc fsnotify: new tracepoint in fsnotify() 2026-05-15 19:24:33 +02:00
stages mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
bpf_probe.h bpf: Add sleepable support for raw tracepoint programs 2026-04-22 22:44:24 +02:00
define_custom_trace.h
define_remote_events.h tracing: Add helpers to create trace remote events 2026-03-09 12:33:54 -04:00
define_trace.h
perf.h tracing: perf: Have perf tracepoint callbacks always disable preemption 2026-01-30 10:43:35 -05:00
syscall.h
trace_custom_events.h
trace_events.h tracing: Make per-template BTF id lists file-local 2026-08-05 22:02:29 -04:00