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

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

 



Dear Arunpravin,


Am 21.03.22 um 06:59 schrieb Arunpravin Paneer Selvam:
add a simple check to reject any size not aligned to the
min_page_size.

Nit: I’d start sentences with a capital letter.

Could you please add a summary of the discussion to the commit message, so the question “Why?” is answered?


Kind regards,

Paul


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);



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux