Commit c8b6f4ad authored by Pranjal Ramajor Asha Kanojiya's avatar Pranjal Ramajor Asha Kanojiya Committed by Jeffrey Hugo

accel/qaic: Fix GEM import path code

Do not modify the size of dmabuf as it is immutable.

Fixes: ff13be83 ("accel/qaic: Add datapath")
Signed-off-by: default avatarPranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Reviewed-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
Reviewed-by: default avatarJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231208163101.1295769-2-quic_jhugo@quicinc.com
parent 6c9dbee8
...@@ -777,7 +777,6 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_ ...@@ -777,7 +777,6 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_
struct dma_buf_attachment *attach; struct dma_buf_attachment *attach;
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct qaic_bo *bo; struct qaic_bo *bo;
size_t size;
int ret; int ret;
bo = qaic_alloc_init_bo(); bo = qaic_alloc_init_bo();
...@@ -795,13 +794,12 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_ ...@@ -795,13 +794,12 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_
goto attach_fail; goto attach_fail;
} }
size = PAGE_ALIGN(attach->dmabuf->size); if (!attach->dmabuf->size) {
if (size == 0) {
ret = -EINVAL; ret = -EINVAL;
goto size_align_fail; goto size_align_fail;
} }
drm_gem_private_object_init(dev, obj, size); drm_gem_private_object_init(dev, obj, attach->dmabuf->size);
/* /*
* skipping dma_buf_map_attachment() as we do not know the direction * skipping dma_buf_map_attachment() as we do not know the direction
* just yet. Once the direction is known in the subsequent IOCTL to * just yet. Once the direction is known in the subsequent IOCTL to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment