Message ID | 20220321055940.4851-1-Arunpravin.PaneerSelvam@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: add a check to verify the size alignment | expand |
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@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);
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);
add a simple check to reject any size not aligned to the min_page_size. Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> --- drivers/gpu/drm/drm_buddy.c | 3 +++ 1 file changed, 3 insertions(+)