kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [patch] drm/i915: memory leak in __i915_gem_vma_create()
Date: Wed, 18 Mar 2015 08:41:06 +0000	[thread overview]
Message-ID: <20150318084106.GE31422@phenom.ffwll.local> (raw)
In-Reply-To: <87k2yepuqq.fsf@intel.com>

On Wed, Mar 18, 2015 at 10:36:45AM +0200, Jani Nikula wrote:
> On Wed, 18 Mar 2015, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > In the original code then if WARN_ON(i915_is_ggtt(vm) != !!ggtt_view)
> > was true then we leak "vma".  Presumably that doesn't happen often but
> > static checkers complain and this bug is easy to fix.
> >
> > Fixes: c3bbb6f2825d ('drm/i915: Do not use ggtt_view with (aliasing) PPGTT')
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

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

> 
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index f1b9ea6..cbf013f 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -2340,12 +2340,13 @@ __i915_gem_vma_create(struct drm_i915_gem_object *obj,
> >  		      struct i915_address_space *vm,
> >  		      const struct i915_ggtt_view *ggtt_view)
> >  {
> > -	struct i915_vma *vma = kzalloc(sizeof(*vma), GFP_KERNEL);
> > -	if (vma = NULL)
> > -		return ERR_PTR(-ENOMEM);
> > +	struct i915_vma *vma;
> >  
> >  	if (WARN_ON(i915_is_ggtt(vm) != !!ggtt_view))
> >  		return ERR_PTR(-EINVAL);
> > +	vma = kzalloc(sizeof(*vma), GFP_KERNEL);
> > +	if (vma = NULL)
> > +		return ERR_PTR(-ENOMEM);
> >  
> >  	INIT_LIST_HEAD(&vma->vma_link);
> >  	INIT_LIST_HEAD(&vma->mm_list);
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> 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

  reply	other threads:[~2015-03-18  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  8:21 [patch] drm/i915: memory leak in __i915_gem_vma_create() Dan Carpenter
2015-03-18  8:36 ` Jani Nikula
2015-03-18  8:41   ` Daniel Vetter [this message]
2015-03-18 11:36     ` [Intel-gfx] " Joonas Lahtinen

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=20150318084106.GE31422@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).