mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V1] accel/amdxdna: Reject a zero sized buffer in amdxdna_gem_prime_import()
@ 2026-11-20  2:35 Lizhi Hou
  2026-11-20 12:32 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Lizhi Hou @ 2026-11-20  2:35 UTC (permalink / raw)
  To: ogabbay, quic_jhugo, dri-devel, mario.limonciello,
	karol.wachowski, max.zhen, christian.koenig, linaro-mm-sig
  Cc: Lizhi Hou, linux-kernel, sonal.santan

Zero sized buffer is not supported. Check the buffer size and return
-EINVAL if the size is zero.

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);
-- 
2.34.1


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

end of thread, other threads:[~2026-11-20 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2026-11-20 18:44   ` Lizhi Hou

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®