All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>,
	Jike Song <jike.song@intel.com>, David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>,
	intel-gvt-dev@lists.freedesktop.org
Subject: Re: [Intel-gfx] [patch] drm/i915/gvt/kvmgt: remove some dead code
Date: Tue, 07 Feb 2017 14:44:29 +0000	[thread overview]
Message-ID: <20170207144429.GM11103@mwanda> (raw)
In-Reply-To: <1486478097.3121.120.camel@linux.intel.com>

On Tue, Feb 07, 2017 at 04:34:57PM +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-07 at 16:16 +0300, Dan Carpenter wrote:
> > If "caps.buf" is already NULL then it doesn't need to be freed or set to
> > NULL.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> <SNIP>
> 
> > @@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> >  			sparse->areas[0].offset > >  					PAGE_ALIGN(vgpu_aperture_offset(vgpu));
> >  			sparse->areas[0].size = vgpu_aperture_sz(vgpu);
> > -			if (!caps.buf) {
> 
> Looking at the code around, the right thing would be to just remove the
> negation? This currently seems like a memory leak.
> 
> > -				kfree(caps.buf);
> > -				caps.buf = NULL;
> > +			if (!caps.buf)
> >  				caps.size = 0;
> > -			}
> 
> And quickly looking, the caps is pre-initialized but unused at this
> point, so the whole if could just be removed, right?

Hm...  Duh.  You're right.  Let me resend.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>,
	Jike Song <jike.song@intel.com>, David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>,
	intel-gvt-dev@lists.freedesktop.org
Subject: Re: [Intel-gfx] [patch] drm/i915/gvt/kvmgt: remove some dead code
Date: Tue, 7 Feb 2017 17:44:29 +0300	[thread overview]
Message-ID: <20170207144429.GM11103@mwanda> (raw)
In-Reply-To: <1486478097.3121.120.camel@linux.intel.com>

On Tue, Feb 07, 2017 at 04:34:57PM +0200, Joonas Lahtinen wrote:
> On ti, 2017-02-07 at 16:16 +0300, Dan Carpenter wrote:
> > If "caps.buf" is already NULL then it doesn't need to be freed or set to
> > NULL.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> <SNIP>
> 
> > @@ -965,11 +965,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> >  			sparse->areas[0].offset =
> >  					PAGE_ALIGN(vgpu_aperture_offset(vgpu));
> >  			sparse->areas[0].size = vgpu_aperture_sz(vgpu);
> > -			if (!caps.buf) {
> 
> Looking at the code around, the right thing would be to just remove the
> negation? This currently seems like a memory leak.
> 
> > -				kfree(caps.buf);
> > -				caps.buf = NULL;
> > +			if (!caps.buf)
> >  				caps.size = 0;
> > -			}
> 
> And quickly looking, the caps is pre-initialized but unused at this
> point, so the whole if could just be removed, right?

Hm...  Duh.  You're right.  Let me resend.

regards,
dan carpenter


  reply	other threads:[~2017-02-07 14:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 13:16 [patch] drm/i915/gvt/kvmgt: remove some dead code Dan Carpenter
2017-02-07 13:16 ` Dan Carpenter
2017-02-07 14:34 ` [Intel-gfx] " Joonas Lahtinen
2017-02-07 14:34   ` Joonas Lahtinen
2017-02-07 14:44   ` Dan Carpenter [this message]
2017-02-07 14:44     ` [Intel-gfx] " Dan Carpenter
2017-02-07 14:53   ` [patch v2] " Dan Carpenter
2017-02-07 14:53     ` Dan Carpenter
2017-02-08 12:49     ` [Intel-gfx] " Joonas Lahtinen
2017-02-08 12:49       ` Joonas Lahtinen
2017-02-09  1:40       ` [Intel-gfx] " Zhenyu Wang
2017-02-09  1:40         ` Zhenyu Wang

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=20170207144429.GM11103@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jike.song@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=zhenyuw@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.