From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH] drm/i915: check gem bo size when creating framebuffers Date: Wed, 9 Oct 2013 13:07:49 +0300 Message-ID: <20131009100749.GB13047@intel.com> References: <1381307588-25281-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1381307588-25281-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Daniel Vetter Cc: Intel Graphics Development , DRI Development List-Id: intel-gfx@lists.freedesktop.org On Wed, Oct 09, 2013 at 10:33:08AM +0200, Daniel Vetter wrote: > It's better to catch such fallout early, and this way we can rely on > the checking done by the drm core on fb->heigh/width at modeset time. > = > If we ever support planar formats on intel we might want to look into > a common helper to do all this, but for now this is good enough. I had a helper to do that, and I think I even posted it a few times. But it didn't take tiling into account, so I didn't feel it was quite good enough. I think this may be the last one: http://lists.freedesktop.org/archives/dri-devel/2011-December/017581.html Your patch doesn't account for tiling either. > = > Requested-by: Chris Wilson > Cc: Chris Wilson > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/i915/intel_display.c | 4 ++++ > 1 file changed, 4 insertions(+) > = > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/= intel_display.c > index f5126b8..3073154 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -10069,6 +10069,10 @@ int intel_framebuffer_init(struct drm_device *de= v, > if (mode_cmd->offsets[0] !=3D 0) > return -EINVAL; > = > + /* FIXME drm helper for size checks (especially planar formats)? */ > + if (obj->base.size < mode_cmd->height * mode_cmd->pitches[0]) > + return -EINVAL; > + > drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd); > intel_fb->obj =3D obj; > = > -- = > 1.8.4.rc3 > = > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- = Ville Syrj=E4l=E4 Intel OTC