All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Jike Song <jike.song@intel.com>
Cc: 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:34:57 +0000	[thread overview]
Message-ID: <1486478097.3121.120.camel@linux.intel.com> (raw)
In-Reply-To: <20170207131630.GA28207@mwanda>

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?

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

WARNING: multiple messages have this Message-ID (diff)
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Jike Song <jike.song@intel.com>
Cc: 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: [patch] drm/i915/gvt/kvmgt: remove some dead code
Date: Tue, 07 Feb 2017 16:34:57 +0200	[thread overview]
Message-ID: <1486478097.3121.120.camel@linux.intel.com> (raw)
In-Reply-To: <20170207131630.GA28207@mwanda>

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?

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-02-07 14:34 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 ` Joonas Lahtinen [this message]
2017-02-07 14:34   ` Joonas Lahtinen
2017-02-07 14:44   ` [Intel-gfx] " Dan Carpenter
2017-02-07 14:44     ` 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=1486478097.3121.120.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --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=intel-gvt-dev@lists.freedesktop.org \
    --cc=jike.song@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.