aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_framebuffer.c')
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 0375b3d7f8d0..7e00c9909c01 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -218,12 +218,16 @@ static int framebuffer_check(struct drm_device *dev,
if (min_pitch > UINT_MAX)
return -ERANGE;
- if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX)
- return -ERANGE;
-
- if (block_size && r->pitches[i] < min_pitch) {
- DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i);
- return -EINVAL;
+ if (r->modifier[i] == DRM_FORMAT_MOD_LINEAR) {
+ if ((uint64_t)height * r->pitches[i] + r->offsets[i] >
+ UINT_MAX)
+ return -ERANGE;
+
+ if (block_size && r->pitches[i] < min_pitch) {
+ DRM_DEBUG_KMS("bad pitch %u for plane %d\n",
+ r->pitches[i], i);
+ return -EINVAL;
+ }
}
if (r->modifier[i] && !(r->flags & DRM_MODE_FB_MODIFIERS)) {