public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Namrta Salonie <namrta.salonie@intel.com>
Cc: Deepak S <deepak.s@intel.com>,
	intel-gfx@lists.freedesktop.org, akash.goel@intel.com
Subject: Re: [PATCH] drm/i915: Fix possible null dereference in framebuffer_info debugfs function
Date: Mon, 30 Nov 2015 09:14:02 +0100	[thread overview]
Message-ID: <20151130081402.GH17050@phenom.ffwll.local> (raw)
In-Reply-To: <1448611991-18615-1-git-send-email-namrta.salonie@intel.com>

On Fri, Nov 27, 2015 at 01:43:11PM +0530, Namrta Salonie wrote:
> Found by static code analysis tool.
> 
> v2: Inserted block instead of goto & renamed variables (Chris)
> v3: Aligned code as per the opening brace (Chris)
>     Rebased on top of nightly (Daniel)
> 
> Signed-off-by: Namrta Salonie <namrta.salonie@intel.com>
> Signed-off-by: Deepak S <deepak.s@intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c |   36 ++++++++++++++++-------------------
>  1 file changed, 16 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index a728ff1..bfd57fb 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1869,33 +1869,29 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
>  {
>  	struct drm_info_node *node = m->private;
>  	struct drm_device *dev = node->minor->dev;
> -	struct intel_fbdev *ifbdev = NULL;
> -	struct intel_framebuffer *fb;
> +	struct intel_framebuffer *fbdev_fb = NULL;
>  	struct drm_framebuffer *drm_fb;
>  
>  #ifdef CONFIG_DRM_FBDEV_EMULATION
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	ifbdev = dev_priv->fbdev;
> -	if (ifbdev) {
> -		fb = to_intel_framebuffer(ifbdev->helper.fb);
> -
> -		seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ",
> -			   fb->base.width,
> -			   fb->base.height,
> -			   fb->base.depth,
> -			   fb->base.bits_per_pixel,
> -			   fb->base.modifier[0],
> -			   atomic_read(&fb->base.refcount.refcount));
> -		describe_obj(m, fb->obj);
> -		seq_putc(m, '\n');
> -	}
> +       if (to_i915(dev)->fbdev) {
> +               fbdev_fb = to_intel_framebuffer(to_i915(dev)->fbdev->helper.fb);
> +
> +               seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ",
> +                         fbdev_fb->base.width,
> +                         fbdev_fb->base.height,
> +                         fbdev_fb->base.depth,
> +                         fbdev_fb->base.bits_per_pixel,
> +                         fbdev_fb->base.modifier[0],
> +                         atomic_read(&fbdev_fb->base.refcount.refcount));
> +               describe_obj(m, fbdev_fb->obj);
> +               seq_putc(m, '\n');
> +       }
>  #endif
>  
>  	mutex_lock(&dev->mode_config.fb_lock);
>  	drm_for_each_fb(drm_fb, dev) {
> -		fb = to_intel_framebuffer(drm_fb);
> -		if (ifbdev && &fb->base == ifbdev->helper.fb)
> +		struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
> +		if (fb == fbdev_fb)
>  			continue;
>  
>  		seq_printf(m, "user size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ",
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-11-30  8:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 11:27 [PATCH 0/4] Fix issues reported by static code analysis tool Namrta Salonie
2015-11-19 11:27 ` [PATCH 1/4] drm/i915: Fix for potential NULL pointer dereference at ctx access Namrta Salonie
2015-11-19 11:40   ` Chris Wilson
2015-11-19 11:27 ` [PATCH 2/4] drm/i915: Fix possible null dereference in two debugfs functions Namrta Salonie
2015-11-19 11:37   ` Chris Wilson
2015-11-26 11:02     ` [PATCH] drm/i915: Fix possible null dereference in framebuffer_info debugfs function Namrta Salonie
2015-11-26 12:43       ` Chris Wilson
2015-11-26 14:38         ` Daniel Vetter
2015-11-27  8:13         ` Namrta Salonie
2015-11-30  8:14           ` Daniel Vetter [this message]
2015-11-19 11:27 ` [PATCH 3/4] drm/i915 : Fix to remove unnecsessary checks in postclose function Namrta Salonie
2015-11-19 15:32   ` Daniel Vetter
2015-11-19 11:27 ` [PATCH 4/4] drm/i915: Fix potential NULL pointer de-reference in ggtt unbind Namrta Salonie
2015-11-19 11:39   ` Chris Wilson

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=20151130081402.GH17050@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=akash.goel@intel.com \
    --cc=deepak.s@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=namrta.salonie@intel.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