octeontx2: Fix otx2_dma_map_page() error return code
PATCH 1/1 octeontx2: Fix otx2_dma_map_page() error return code
0 is a valid DMA address [1] so using it as the error value can lead to errors. The error value of dma_map_XXX() functions is DMA_MAPPING_ERROR which is ~0. The callers of otx2_dma_map_page() use dma_mapping_error() to test the return value of otx2_dma_map_page(). This means that they would not detect an error in otx2_dma_map_page().
Make otx2_dma_map_page() return the raw value of dma_map_page_attrs().
[1] https://lore.kernel.org/all/[email protected]
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -6
@@ -940,13 +940,8 @@ static inline dma_addr_t otx2_dma_map_page(struct otx2_nic *pfvf, size_t offset, size_t size, enum dma_data_direction dir) { - dma_addr_t iova; - - iova =dma_map_page_attrs (pfvf->dev, page, + return dma_map_page_attrs(pfvf->dev, page,offset ,size ,dir ,DMA_ATTR_SKIP_CPU_SYNC ); -if (unlikely (dma_mapping_error (pfvf->dev, iova))) -return (dma_addr_t )NULL ; -return iova; } static inline void otx2_dma_unmap_page(struct otx2_nic *pfvf,
Signature · 1 line
2.43.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 14 Jan 2026 13:31:06 +0100 you wrote:
0 is a valid DMA address [1] so using it as the error value can lead to errors. The error value of
dma_map_XXX()functions isDMA_MAPPING_ERRORwhich is ~0. The callers ofotx2_dma_map_page()usedma_mapping_error()to test the return value ofotx2_dma_map_page(). This means that they would not detect an error inotx2_dma_map_page().Make
otx2_dma_map_page()return the raw value ofdma_map_page_attrs().[...]
Here is the summary with links:
- octeontx2: Fix otx2_dma_map_page() error return code
https://git.kernel.org/netdev/net/c/d998b0e5afff
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html