diff options
| author | Donggeun Yoo <donggeunyoo.kernel@gmail.com> | 2026-09-07 21:01:24 +0900 |
|---|---|---|
| committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2026-09-09 12:02:33 +0200 |
| commit | 92c6a8d6470f7e7aa86c1f144818d8fa4fcbd5aa (patch) | |
| tree | a5c02050ca60a5f4cc13cee7757b815d0f1eb866 /scripts/Makefile.thinlto | |
| parent | b7d7914a9ae3097e63d113007e4fb44d33d515b1 (diff) | |
| download | linux-92c6a8d6470f7e7aa86c1f144818d8fa4fcbd5aa.tar.gz linux-92c6a8d6470f7e7aa86c1f144818d8fa4fcbd5aa.zip | |
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: 038eb433dc14 ("dma-mapping: add tracing for dma-mapping API calls")
Fixes: 68b6dbf1f441 ("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>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
