mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: yangge1116@126.com
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, robin.murphy@arm.com, hch@lst.de,
	liuzixing@hygon.cn
Subject: Re: [PATCH] dma-direct: fix type mismatch in dma_direct_alloc_pages
Date: Fri, 14 Aug 2026 09:11:14 +0200	[thread overview]
Message-ID: <22a4aa19-39c8-4f3d-9542-b2dce50125d1@samsung.com> (raw)
In-Reply-To: <1786689000-14677-1-git-send-email-yangge1116@126.com>

On 14.08.2026 08:30, yangge1116@126.com wrote:
> From: Ge Yang <yangge1116@126.com>
>
> The pool allocation path directly returned the void* cpu virtual
> address from dma_direct_alloc_from_pool(), which is type‑mismatched
> against struct page *. Convert the dma_handle to page via
> dma_direct_to_page() instead.
>
> Fixes: 5b138c534fda ("dma-direct: factor out a dma_direct_alloc_from_pool helper")
> Signed-off-by: Ge Yang <yangge1116@126.com>
> Cc: stable@vger.kernel.org

This is a duplicate of the patch already applied to dma-mapping-for-next, see

https://lore.kernel.org/r/20260717180442.110954-2-aneesh.kumar@kernel.org

> ---
>  kernel/dma/direct.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> index 4391b79..f496568 100644
> --- a/kernel/dma/direct.c
> +++ b/kernel/dma/direct.c
> @@ -356,8 +356,12 @@ struct page *dma_direct_alloc_pages(struct device *dev, size_t size,
>  	struct page *page;
>  	void *ret;
>  
> -	if (force_dma_unencrypted(dev) && dma_direct_use_pool(dev, gfp))
> -		return dma_direct_alloc_from_pool(dev, size, dma_handle, gfp);
> +	if (force_dma_unencrypted(dev) && dma_direct_use_pool(dev, gfp)) {
> +		ret = dma_direct_alloc_from_pool(dev, size, dma_handle, gfp);
> +		if (!ret)
> +			return NULL;
> +		return dma_direct_to_page(dev, *dma_handle);
> +	}
>  
>  	page = __dma_direct_alloc_pages(dev, size, gfp, false);
>  	if (!page)

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


      reply	other threads:[~2026-08-14  7:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260814063037eucas1p13a146c907bec7280bb28d9e8ef009eae@eucas1p1.samsung.com>
2026-08-14  6:30 ` yangge1116
2026-08-14  7:11   ` 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=22a4aa19-39c8-4f3d-9542-b2dce50125d1@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuzixing@hygon.cn \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=yangge1116@126.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®