From 7e3f5adacdc3d17fb4d51096822219234ea1360c Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 27 Feb 2025 17:55:02 +0000 Subject: [PATCH] drm/framebuffer: Pitch checks aren't valid for non-linear modifiers Pitch has no meaning if the modifier isn't DRM_FORMAT_MOD_LINEAR as there is no guarantee that the value passed follows the pattern that pitch * height = size. Remove that check from framebuffer_check. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/drm_framebuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -199,7 +199,8 @@ static int framebuffer_check(struct drm_ if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX) return -ERANGE; - if (block_size && r->pitches[i] < min_pitch) { + if (r->modifier[i] == DRM_FORMAT_MOD_LINEAR && block_size && + r->pitches[i] < min_pitch) { drm_dbg_kms(dev, "bad pitch %u for plane %d\n", r->pitches[i], i); return -EINVAL; }