From: Thierry Reding Subject: Re: [PATCH] drm/cma-helper: fixup compilation Date: Tue, 19 Feb 2013 11:25:41 +0100 Message-ID: <20130219102541.GB21321@avionic-0098.mockup.avionic-design.de> References: <1360923875-26691-1-git-send-email-daniel.vetter@ffwll.ch> <20130219074339.GA5456@avionic-0098.mockup.avionic-design.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1398079611==" Return-path: Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by gabe.freedesktop.org (Postfix) with ESMTP id 69D05E60E8 for ; Tue, 19 Feb 2013 02:25:52 -0800 (PST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Daniel Vetter Cc: Laurent Pinchart , DRI Development List-Id: dri-devel@lists.freedesktop.org --===============1398079611== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 19, 2013 at 11:16:08AM +0100, Daniel Vetter wrote: > On Tue, Feb 19, 2013 at 8:43 AM, Thierry Reding > wrote: > > On Fri, Feb 15, 2013 at 11:24:35AM +0100, Daniel Vetter wrote: > >> /me grabs a few brown paper bags > >> > >> So it looks like I've broken compilation in > >> > >> commit 6aed8ec3f76a22217c9ae183d32b1aa990bed069 > >> Author: Daniel Vetter > >> Date: Sun Jan 20 17:32:21 2013 +0100 > >> > >> drm: review locking for drm_fb_helper_restore_fbdev_mode > >> > >> Fix it up again. > >> > >> Reported-by: Wu Fengguang > >> Signed-off-by: Daniel Vetter > >> --- > >> drivers/gpu/drm/drm_fb_cma_helper.c | 2 ++ > >> 1 file changed, 2 insertions(+) > >> > >> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm= _fb_cma_helper.c > >> index e851658..ef68e34 100644 > >> --- a/drivers/gpu/drm/drm_fb_cma_helper.c > >> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c > >> @@ -377,6 +377,8 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini); > >> */ > >> void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma) > >> { > >> + struct drm_device *dev =3D fbdev_cma->fb_helper.dev; > >> + > >> drm_modeset_lock_all(dev); > >> if (fbdev_cma) > >> drm_fb_helper_restore_fbdev_mode(&fbdev_cma->fb_helper); > > > > The above check indicates that fbdev_cma might be NULL, so you're > > potentially dereferencing NULL when assigning the dev variable. >=20 > Right, looks like a need more brown-paper bags. >=20 > > Perhaps a better way would be to move the locking into the if block, as > > in the patch below. >=20 > Otoh I think it's a bit funny that you can pass NULL to restore_mode > and hotplug_event in the cma fb helper code. Imo it would be better to > just ditch those checks ... Laurent? I'll update the patch meanwhile. I agree, it is probably safe to drop the checks and consider it a driver error (and let it oops accordingly) if NULL is ever passed in. I expect drivers will usually bail out if drm_fbdev_cma_init() fails. If they choose to continue maybe they should be responsible for not calling drm_fbdev_cma_restore_mode() if fbdev is NULL. Thierry --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAEBAgAGBQJRI1MlAAoJEN0jrNd/PrOh0HMP/3hScZL3PjcGROsqS/OMcaCp MQLQCJ+sJ6RsT2FPB12wftbP9K6hM07V9AfJ06y8uWpbgOK3bRuj23uV9CN1H/lY f4SDL4jJzxpsN3EK9EjRuQ841Kza+r30gPUYXzkIFZ8CaKk2nNH9t9brr805WOOX qe+Ooji+WQB1WTXrOgW9/NfkRybjLvxnztf/NUvUV53fyOBinCU+CcSLzNdu5Hhv VyUBD2PtVCefPQjTyW9yzb5R/HrzJrvt5m8KV7kZgHNE4bk3mCcn18uOHO3ypqIu +LL3FNbc+w/WHGQN8cBEz8T3X5BsJQHpJrDcYBVmZD1RFEkdmLCA7U68Nm8jOmRJ k5OqLOBIgeLTpCJbkoCsW0uq95h9q93P8Q00aUpwenONaodOEWwsezH3EUXqA7Vw qBulsB86jv0qbtq6rq+4lvQpjbMpfB7eJXQ6Jc/J1GoKrqURy1KXw3Zfm7EyeXww 7fhQfkFK+M62sd07ssEV+Plt8/mqDexrMS59wUA76tGcNTFVKWVgaXJ3WC/fk2mh 1LxiRdpd2ACBwh8UI0xSk90ubEbQ5SfwkZ+o8gLw4Lx1hvKa9xVwlkWgwNkC9+r/ qilnr+YMeePStnDyRj+92I6e8agaK55hOqpXahv0ssVx77uWGop+SyrPnqlGxI+D H+oHKeseD2h6L3JSb+oT =p+2h -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp-- --===============1398079611== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1398079611==--