[Intel-xe] [PATCH] fixup! drm/xe: Apply upper limit to sg element size

Niranjana Vishwanathapura niranjana.vishwanathapura at intel.com
Fri Jun 2 03:12:41 UTC 2023


Replace UINT_MAX with maximum value supported by sg->length.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
---
 drivers/gpu/drm/xe/xe_bo.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
index d945675a259f..e6d08fa9c992 100644
--- a/drivers/gpu/drm/xe/xe_bo.h
+++ b/drivers/gpu/drm/xe/xe_bo.h
@@ -306,7 +306,10 @@ struct sg_table *xe_bo_get_sg(struct xe_bo *bo);
  */
 static inline unsigned int xe_sg_segment_size(struct device *dev)
 {
-	size_t max = min_t(size_t, UINT_MAX, dma_max_mapping_size(dev));
+	struct scatterlist __maybe_unused sg;
+	size_t max = BIT_ULL(sizeof(sg.length) * 8) - 1;
+
+	max = min_t(size_t, max, dma_max_mapping_size(dev));
 
 	/*
 	 * The iommu_dma_map_sg() function ensures iova allocation doesn't
-- 
2.21.0.rc0.32.g243a4c7e27



More information about the Intel-xe mailing list