From: Marek Szyprowski <m.szyprowski@samsung.com>
To: lirongqing <lirongqing@baidu.com>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-debug: fix physical address retrieval in debug_dma_sync_sg_for_device
Date: Wed, 3 Jun 2026 18:25:41 +0200 [thread overview]
Message-ID: <fbce1140-eb8d-4afd-a92a-424859bcbeca@samsung.com> (raw)
In-Reply-To: <20260603123708.1665-1-lirongqing@baidu.com>
On 03.06.2026 14:37, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> In debug_dma_sync_sg_for_device(), when iterating over a scatterlist,
> the debug entry population mistakenly uses the head of the scatterlist
> 'sg' to fetch the physical address via sg_phys(), instead of using the
> current iterator variable 's'.
>
> This causes dma-debug to track the physical address of the very first
> scatterlist entry for all subsequent entries in the list.
>
> Fix this by passing the correct loop iterator 's' to sg_phys()
>
> Fixes: 9d4f645a1fd49ee ("dma-debug: store a phys_addr_t in struct dma_debug_entry")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
Nice catch! Applied to dma-mapping-fixes, thanks!
> ---
> kernel/dma/debug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
> index 3248f8b..2c0e2cd 100644
> --- a/kernel/dma/debug.c
> +++ b/kernel/dma/debug.c
> @@ -1556,7 +1556,7 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
> struct dma_debug_entry ref = {
> .type = dma_debug_sg,
> .dev = dev,
> - .paddr = sg_phys(sg),
> + .paddr = sg_phys(s),
> .dev_addr = sg_dma_address(s),
> .size = sg_dma_len(s),
> .direction = direction,
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
prev parent reply other threads:[~2026-06-03 16:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260603123724eucas1p1d84be25a6da439618a24931e65315cd8@eucas1p1.samsung.com>
2026-06-03 12:37 ` lirongqing
2026-06-03 16:25 ` Marek Szyprowski [this message]
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=fbce1140-eb8d-4afd-a92a-424859bcbeca@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=robin.murphy@arm.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
all inboxes | Powered by JetHome®