diff options
author | Matthew Auld <[email protected]> | 2024-02-19 12:18:53 +0000 |
---|---|---|
committer | Christian König <[email protected]> | 2024-02-28 08:02:53 +0100 |
commit | 2986314aa811c8a23aeb292edd30315495d54966 (patch) | |
tree | 771120d06be2bcb2be693b4b4b9e6e7edf9d9e02 | |
parent | f41900e4a6ef019d64a70394b0e0c3bd048d4ec8 (diff) |
drm/buddy: check range allocation matches alignment
Likely not a big deal for real users, but for consistency we should
respect the min_page_size here. Main issue is that bias allocations
turns into normal range allocation if the range and size matches
exactly, and in the next patch we want to add some unit tests for this
part of the api.
Signed-off-by: Matthew Auld <[email protected]>
Cc: Arunpravin Paneer Selvam <[email protected]>
Cc: Christian König <[email protected]>
Reviewed-by: Arunpravin Paneer Selvam <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Christian König <[email protected]>
-rw-r--r-- | drivers/gpu/drm/drm_buddy.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c index f3a6ac908f81..5ebdd6f8f36e 100644 --- a/drivers/gpu/drm/drm_buddy.c +++ b/drivers/gpu/drm/drm_buddy.c @@ -771,8 +771,12 @@ int drm_buddy_alloc_blocks(struct drm_buddy *mm, return -EINVAL; /* Actual range allocation */ - if (start + size == end) + if (start + size == end) { + if (!IS_ALIGNED(start | end, min_block_size)) + return -EINVAL; + return __drm_buddy_alloc_range(mm, start, size, NULL, blocks); + } original_size = size; original_min_size = min_block_size; |