netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Potnuri Bharat Teja <bharat@chelsio.com>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] ethernet: cxgb4: Fix dma_unmap_sg() nents value
Date: Tue, 24 Jun 2025 20:47:04 +0530	[thread overview]
Message-ID: <aFrBED5rhHtrN0sv@chelsio.com> (raw)
In-Reply-To: <20250623122557.116906-2-fourier.thomas@gmail.com>

On Monday, June 06/23/25, 2025 at 14:25:55 +0200, Thomas Fourier wrote:
> The dma_unmap_sg() functions should be called with the same nents as the
> dma_map_sg(), not the value the map function returned.
> 
> Fixes: 8b4e6b3ca2ed ("cxgb4: Add HMA support")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> ---
>  drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> index 51395c96b2e9..73bb1f413761 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
> @@ -3998,7 +3998,7 @@ static void adap_free_hma_mem(struct adapter *adapter)
>  
>  	if (adapter->hma.flags & HMA_DMA_MAPPED_FLAG) {
>  		dma_unmap_sg(adapter->pdev_dev, adapter->hma.sgt->sgl,
> -			     adapter->hma.sgt->nents, DMA_BIDIRECTIONAL);
> +			     adapter->hma.sgt->orig_nents, DMA_BIDIRECTIONAL);
>  		adapter->hma.flags &= ~HMA_DMA_MAPPED_FLAG;
>  	}
Thanks for the patch Thomas.
this fix needs below change as well:
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4000,7 +4000,7 @@ static void adap_free_hma_mem(struct adapter *adapter)
        }

	for_each_sg(adapter->hma.sgt->sgl, iter,	
-                   adapter->hma.sgt->orig_nents, i) {
+                   adapter->hma.sgt->nents, i) {
                page = sg_page(iter);
		if (page)
                        __free_pages(page, HMA_PAGE_ORDER);		
 

> -- 
> 2.43.0
> 

  reply	other threads:[~2025-06-24 15:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 12:25 [PATCH net] ethernet: cxgb4: Fix dma_unmap_sg() nents value Thomas Fourier
2025-06-24 15:17 ` Potnuri Bharat Teja [this message]
2025-06-25 13:27   ` Thomas Fourier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aFrBED5rhHtrN0sv@chelsio.com \
    --to=bharat@chelsio.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fourier.thomas@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).