dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@avionic-design.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/cma-helper: fixup compilation
Date: Tue, 19 Feb 2013 11:25:41 +0100	[thread overview]
Message-ID: <20130219102541.GB21321@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <CAKMK7uF_yAwpG8vTFq=J_6RyM+A2LpROYRDRB7v+PZZb9n0djw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2286 bytes --]

On Tue, Feb 19, 2013 at 11:16:08AM +0100, Daniel Vetter wrote:
> On Tue, Feb 19, 2013 at 8:43 AM, Thierry Reding
> <thierry.reding@avionic-design.de> 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 <daniel.vetter@ffwll.ch>
> >> 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 <fengguang.wu@intel.com>
> >> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> >> ---
> >>  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 = 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.
> 
> Right, looks like a need more brown-paper bags.
> 
> > Perhaps a better way would be to move the locking into the if block, as
> > in the patch below.
> 
> 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

[-- Attachment #1.2: Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2013-02-19 10:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 10:24 [PATCH] drm/cma-helper: fixup compilation Daniel Vetter
2013-02-19  7:43 ` Thierry Reding
2013-02-19 10:16   ` Daniel Vetter
2013-02-19 10:25     ` Thierry Reding [this message]
2013-02-19 10:18   ` Daniel Vetter
2013-02-19 10:22     ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130219102541.GB21321@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox