The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=33574d47d9dea317b9a4bfe543c4f20be6a565ef
commit 33574d47d9dea317b9a4bfe543c4f20be6a565ef Author: Zishun Yi <[email protected]> AuthorDate: 2026-09-05 20:12:38 +0000 Commit: Bjoern A. Zeeb <[email protected]> CommitDate: 2026-09-06 00:12:48 +0000 LinuxKPI: Correct nents passed to dma_{un,}map_sg_attrs() According to Linux documentation the nents argument to dma_unmap_sg() must be the number one passed in, not the number of DMA addresses. In LinuxKPI this means orig_nents and not nents, so adjust this. Given nents and orig_nents should always be the same in LinuxKPI, this should only be a NOP for correctness. Reviewed by: bz, aokblast (LGTM) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D57842 --- sys/compat/linuxkpi/common/include/linux/dma-mapping.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h index e7589056ae46..8caf88273846 100644 --- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h @@ -448,7 +448,7 @@ dma_map_sgtable(struct device *dev, struct sg_table *sgt, { int nents; - nents = dma_map_sg_attrs(dev, sgt->sgl, sgt->nents, dir, attrs); + nents = dma_map_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs); if (nents < 0) return (nents); sgt->nents = nents; @@ -461,7 +461,7 @@ dma_unmap_sgtable(struct device *dev, struct sg_table *sgt, unsigned long attrs) { - dma_unmap_sg_attrs(dev, sgt->sgl, sgt->nents, dir, attrs); + dma_unmap_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs); }
