This reverts commit 5ab62dd3687bcc2cc542b99385aabac5c996db6f. It causes a regression in Intel CI[1].
[1] https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/16308 References: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/16326 Signed-off-by: Chaitanya Kumar Borah <[email protected]> --- drivers/gpu/drm/drm_dumb_buffers.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c index e60130b2bb0c..61bf3c9b7182 100644 --- a/drivers/gpu/drm/drm_dumb_buffers.c +++ b/drivers/gpu/drm/drm_dumb_buffers.c @@ -69,11 +69,8 @@ static int drm_mode_align_dumb(struct drm_mode_create_dumb *args, if (!pitch) return -EINVAL; - if (hw_pitch_align) { + if (hw_pitch_align) pitch = roundup(pitch, hw_pitch_align); - if (pitch < hw_pitch_align) - return -EINVAL; - } if (!hw_size_align) hw_size_align = PAGE_SIZE; @@ -82,7 +79,7 @@ static int drm_mode_align_dumb(struct drm_mode_create_dumb *args, if (check_mul_overflow(args->height, pitch, &size)) return -EINVAL; - size = roundup(size, hw_size_align); + size = ALIGN(size, hw_size_align); if (!size) return -EINVAL; @@ -201,13 +198,6 @@ int drm_mode_create_dumb(struct drm_device *dev, if (!args->width || !args->height || !args->bpp) return -EINVAL; - /* Reject unreasonable inputs early. Dumb buffers are for software - * rendering; nothing legitimate needs more than 8192x8192 at 32bpp. - * This prevents overflows in downstream alignment helpers. - */ - if (args->width >= 8192 || args->height >= 8192 || args->bpp > 32) - return -EINVAL; - /* overflow checks for 32bit size calculations */ if (args->bpp > U32_MAX - 8) return -EINVAL; -- 2.25.1
