[PATCH] drm: add a check to verify the size alignment
Paul Menzel
pmenzel at molgen.mpg.de
Mon Mar 21 06:17:43 UTC 2022
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 at amd.com>
> ---
> 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);
More information about the amd-gfx
mailing list