From b7684616e4c8da6ddb505bfc5bf67860210ba672 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 9 Jun 2026 11:55:44 +0100
Subject: [PATCH] drm/gem-framebuffer: Don't validate buffer size when
 non-linear

pitch*height does not necessarily equate to buffer size if the
buffer is non-linear, so the buffer validation is invalid.

Disable it for non-linear buffers.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -182,6 +182,9 @@ int drm_gem_fb_init_with_funcs(struct dr
 			goto err_gem_object_put;
 		}
 
+		if (mode_cmd->modifier[i] != DRM_FORMAT_MOD_LINEAR)
+			continue;
+
 		min_size = (height - 1) * mode_cmd->pitches[i]
 			 + drm_format_info_min_pitch(info, i, width)
 			 + mode_cmd->offsets[i];
