[PATCH] drm: add a check to verify the size alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



add a simple check to reject any size not aligned to the
min_page_size.

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@xxxxxxx>
---
 drivers/gpu/drm/drm_buddy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
index 72f52f293249..b503c88786b0 100644
--- a/drivers/gpu/drm/drm_buddy.c
+++ b/drivers/gpu/drm/drm_buddy.c
@@ -661,6 +661,9 @@ int drm_buddy_alloc_blocks(struct drm_buddy *mm,
 	if (range_overflows(start, size, mm->size))
 		return -EINVAL;
 
+	if (WARN_ON(!IS_ALIGNED(size, min_page_size)))
+		return -EINVAL;
+
 	/* Actual range allocation */
 	if (start + size == end)
 		return __drm_buddy_alloc_range(mm, start, size, blocks);
-- 
2.25.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux