[Intel-xe] [PATCH] drm/xe: Align size to PAGE_SIZE
Pallavi Mishra
pallavi.mishra at intel.com
Wed Sep 20 17:54:31 UTC 2023
Ensure alignment with PAGE_SIZE for the size parameter
passed to __xe_bo_create_locked()
Signed-off-by: Pallavi Mishra <pallavi.mishra at intel.com>
---
drivers/gpu/drm/xe/xe_bo.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 1ab682d61e3c..014d084632f2 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1199,6 +1199,9 @@ struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
/* Only kernel objects should set GT */
XE_WARN_ON(tile && type != ttm_bo_type_kernel);
+ if ((size & (PAGE_SIZE - 1)) != 0)
+ size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+
if (XE_WARN_ON(!size)) {
xe_bo_free(bo);
return ERR_PTR(-EINVAL);
--
2.25.1
More information about the Intel-xe
mailing list