All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Lizhi Hou <lizhi.hou@amd.com>,
	ogabbay@kernel.org, quic_jhugo@quicinc.com,
	dri-devel@lists.freedesktop.org, mario.limonciello@amd.com,
	karol.wachowski@linux.intel.com, max.zhen@amd.com,
	linaro-mm-sig@lists.linaro.org
Cc: linux-kernel@vger.kernel.org, sonal.santan@amd.com
Subject: Re: [PATCH V1] accel/amdxdna: Reject a zero sized buffer in amdxdna_gem_prime_import()
Date: Fri, 20 Nov 2026 13:32:25 +0100	[thread overview]
Message-ID: <48d1dd13-9ec6-402f-8a72-ce417f331332@amd.com> (raw)
In-Reply-To: <20261120023540.888381-1-lizhi.hou@amd.com>

On 11/20/26 03:35, Lizhi Hou wrote:
> Zero sized buffer is not supported. Check the buffer size and return
> -EINVAL if the size is zero.

Oh that is surprising a zero sized buffer shouldn't be supported by DMA-buf in the first place.

Doesn't DMA-buf check that somewhere?

Regards,
Christian.

> 
> Fixes: e486147c912f ("accel/amdxdna: Add BO import and export")
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> ---
>  drivers/accel/amdxdna/amdxdna_gem.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
> index ffe12a722dfe..4d7f3de88cd3 100644
> --- a/drivers/accel/amdxdna/amdxdna_gem.c
> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
> @@ -1133,6 +1133,9 @@ amdxdna_gem_prime_import(struct drm_device *dev, struct dma_buf *dma_buf)
>  	struct sg_table *sgt;
>  	int ret;
>  
> +	if (!dma_buf->size)
> +		return ERR_PTR(-EINVAL);
> +
>  	get_dma_buf(dma_buf);
>  
>  	attach = dma_buf_attach(dma_buf, dev->dev);


  reply	other threads:[~2026-11-20 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  2:35 [PATCH V1] accel/amdxdna: Reject a zero sized buffer in amdxdna_gem_prime_import() Lizhi Hou
2026-11-20 12:32 ` Christian König [this message]
2026-11-20 18:44   ` Lizhi Hou
2026-11-23  8:53     ` Christian König
2026-11-23 18:06       ` Lizhi Hou

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=48d1dd13-9ec6-402f-8a72-ce417f331332@amd.com \
    --to=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karol.wachowski@linux.intel.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.hou@amd.com \
    --cc=mario.limonciello@amd.com \
    --cc=max.zhen@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.