public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] octeontx2: Fix otx2_dma_map_page() error return code
@ 2026-01-14 12:31 Thomas Fourier
  2026-01-19 14:18 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2026-01-14 12:31 UTC (permalink / raw)
  Cc: Thomas Fourier, stable, Sunil Goutham, Geetha sowjanya,
	Subbaraya Sundeep, hariprasad, Bharat Bhushan, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

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/f977f68b-cec5-4ab7-b4bd-2cf6aca46267@intel.com

Fixes: caa2da34fd25 ("octeontx2-pf: Initialize and config queues")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index e616a727a3a9..8cdfc36d79d2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -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,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] octeontx2: Fix otx2_dma_map_page() error return code
  2026-01-14 12:31 [PATCH] octeontx2: Fix otx2_dma_map_page() error return code Thomas Fourier
@ 2026-01-19 14:18 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-19 14:18 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: stable, sgoutham, gakula, sbhatta, hkelam, bbhushan2,
	andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 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().
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-19 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-14 12:31 [PATCH] octeontx2: Fix otx2_dma_map_page() error return code Thomas Fourier
2026-01-19 14:18 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox