summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/msm/msm_fb.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2014-11-08 17:20:28 +0300
committerRob Clark <robdclark@gmail.com>2014-11-16 22:27:37 +0300
commit10291bff0a5f811310ac2f6d0e382d00907a2943 (patch)
tree0761773e0852eb026f18858b97d83b1439e75c5a /drivers/gpu/drm/msm/msm_fb.c
parent2638d90abbe7dc23448f6b6b723cb91344cf93aa (diff)
downloadlinux-10291bff0a5f811310ac2f6d0e382d00907a2943.tar.xz
drm/msm: bit of fb error checking
It's a problem that can't happen yet, since we don't support any multi-planar formats yet. But let's avoid nasty surprises when the time comes. Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_fb.c')
-rw-r--r--drivers/gpu/drm/msm/msm_fb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index acf34ec80a75..f4e42d506ff7 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -24,7 +24,7 @@
struct msm_framebuffer {
struct drm_framebuffer base;
const struct msm_format *format;
- struct drm_gem_object *planes[2];
+ struct drm_gem_object *planes[3];
};
#define to_msm_framebuffer(x) container_of(x, struct msm_framebuffer, base)
@@ -202,6 +202,11 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
msm_fb->format = format;
+ if (n > ARRAY_SIZE(msm_fb->planes)) {
+ ret = -EINVAL;
+ goto fail;
+ }
+
for (i = 0; i < n; i++) {
unsigned int width = mode_cmd->width / (i ? hsub : 1);
unsigned int height = mode_cmd->height / (i ? vsub : 1);