]> git.baikalelectronics.ru Git - kernel.git/commit
drm: add a check to verify the size alignment
authorArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Mon, 11 Apr 2022 07:38:34 +0000 (13:08 +0530)
committerChristian König <christian.koenig@amd.com>
Mon, 11 Apr 2022 13:35:47 +0000 (15:35 +0200)
commit59a3c43eee842f24dea88dc0447d767cb3136ce8
tree0ec2835bad157a7046210cb5b27204fc123bcd46
parent9fdb7fcfca0c49d4555b51a04ef39e69261ec58c
drm: add a check to verify the size alignment

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

when size is not aligned to min_page_size, driver module
should handle in their own way either to round_up() the
size value to min_page_size or just to enable WARN_ON().

If we dont handle the alignment properly, we may hit the
following bug, Unigine Heaven has allocation requests for
example required pages are 257 and alignment request is 256.
To allocate the left over 1 page, continues the iteration to
find the order value which is 0 and when it compares with
min_order = 8, triggers the BUG_ON(order < min_order).

v2: add more commit description
v3: remove WARN_ON()

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Suggested-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220411073834.15210-1-Arunpravin.PaneerSelvam@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/drm_buddy.c