* [PATCH V1] accel/amdxdna: Reject a zero sized buffer in amdxdna_gem_prime_import()
@ 2026-11-20 2:35 Lizhi Hou
0 siblings, 0 replies; only message 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] only message in thread
only message in thread, other threads:[~2026-11-20 2:36 UTC | newest]
Thread overview: (only message) (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
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®