From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomi Valkeinen Subject: Re: [PATCH v2 5/8] drm/omap: gem: dumb: pitch is an output Date: Fri, 7 Nov 2014 10:02:51 +0200 Message-ID: <545C7CAB.9080708@ti.com> References: <1415193919-1687-1-git-send-email-thierry.reding@gmail.com> <1415288961-14464-1-git-send-email-thierry.reding@gmail.com> <1415288961-14464-6-git-send-email-thierry.reding@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1503130348==" Return-path: Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by gabe.freedesktop.org (Postfix) with ESMTP id 44B396F2DA for ; Fri, 7 Nov 2014 00:03:09 -0800 (PST) In-Reply-To: <1415288961-14464-6-git-send-email-thierry.reding@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Thierry Reding Cc: Benjamin Gaignard , Daniel Vetter , dri-devel@lists.freedesktop.org, Laurent Pinchart , Dave Airlie , Russell King List-Id: dri-devel@lists.freedesktop.org --===============1503130348== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WgisHFMOFtgveCiJxoNxIlJKBfFVlFPkl" --WgisHFMOFtgveCiJxoNxIlJKBfFVlFPkl Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 06/11/14 17:49, Thierry Reding wrote: > From: Thierry Reding >=20 > When creating a dumb buffer object using the DRM_IOCTL_MODE_CREATE_DUMB= > IOCTL, only the width, height, bpp and flags fields are inputs. The > caller is not guaranteed to zero out or set handle, pitch and size. > Drivers must not treat these values as possible inputs, otherwise they > may use uninitialized memory during the computation of the framebuffer > size. >=20 > The OMAP driver uses the pitch field passed in by userspace as a minimu= m > and only override it if the driver-computed pitch is larger than what > userspace provided. To prevent this from causing overallocation, fix th= e > minimum pitch to 0 to enforce the driver-computed pitch. >=20 > Cc: Tomi Valkeinen > Reviewed-by: Daniel Vetter > Signed-off-by: Thierry Reding > --- > drivers/gpu/drm/omapdrm/omap_gem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapd= rm/omap_gem.c > index e4849413ee80..bff60b73995b 100644 > --- a/drivers/gpu/drm/omapdrm/omap_gem.c > +++ b/drivers/gpu/drm/omapdrm/omap_gem.c > @@ -613,7 +613,7 @@ int omap_gem_dumb_create(struct drm_file *file, str= uct drm_device *dev, > union omap_gem_size gsize; > =20 > /* in case someone tries to feed us a completely bogus stride: */ This comment could also be removed, as it doesn't make sense after this change. > - args->pitch =3D align_pitch(args->pitch, args->width, args->bpp); > + args->pitch =3D align_pitch(0, args->width, args->bpp); > args->size =3D PAGE_ALIGN(args->pitch * args->height); > =20 > gsize =3D (union omap_gem_size){ Acked-by: Tomi Valkeinen Tomi --WgisHFMOFtgveCiJxoNxIlJKBfFVlFPkl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUXHyrAAoJEPo9qoy8lh71NBIP/04svDsorAyjuXU0v/6HuUGT W3PVhTdBWPWX9A4gM6gMAmv/d9zAyCVJpyEFA5QA5cjjQX9zRy7wvDyLFClylvSC rWeQCTbEKGgamXb258fhhJNrn8mFqF1qoYn/s0R483WbW2tO/IVK+5KBFYuSeOMS nI4HGLDCEcglRcLHQzfaF2++7f1J+RB/N5+z6rxPkSqU9bhRIzwT0HVJGIOj49lh srNQg/cfjrXxPZKUApl9CgtjIT5FgUcTto8K6oforJMgVOpUzO4hjzxVb6ehSZ4o 4luxKz/bnRWf38riW7A2LaH2Iwbh2j0ZSzx6UQHSbAwPEo78QujVqUKQsI6vjnle MDs+8FZMVoFdKuJ50UKz7ldH55RIBZhu/g4T+lq9pME0qBI0Dfu4u/Lk1LMsPLjA ifojj+xib5cvHwpVU9oWyZqp9ZkS+vtIYMTbgx7juntFdgwSbqK0/td9O6sdHOyf saaaI1FEsCBdkNn9l5mkltdal2iwYHXmz+fL5VGQvBO72lc4gwZw9v04BzIeT8G4 R2WLn49BhvKz2k28reqM4/ZfGnB2lVyBgzSCzCrpqcmnm0YV4q3SK0QGLpCwOCSz WQLvig6sJkic5HUKAOPQvlEZGGvvSElDgAxX9PNf7erynejaY9JDkHlG7qpTmDBy A9Cn4PwBotl4Pa8Wr34U =cyFA -----END PGP SIGNATURE----- --WgisHFMOFtgveCiJxoNxIlJKBfFVlFPkl-- --===============1503130348== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9kcmktZGV2ZWwK --===============1503130348==--