All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: karol herbst <karolherbst@gmail.com>
Cc: Karol Herbst <nouveau@karolherbst.de>,
	nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case
Date: Fri, 3 Jun 2016 11:42:12 +0100	[thread overview]
Message-ID: <57515F04.8000408@canonical.com> (raw)
In-Reply-To: <CAEXux-ZWRYq_8L=0Ho9DJ+VCYq_Uk=TpvszT01Ms3Lb-fx1u9g@mail.gmail.com>

On 03/06/16 10:55, karol herbst wrote:
> Hi Colin,
> 
> thanks for pointing this out, but I am quite sure this continue
> statement won't ever be hit, ever.
> 
> check the nvkm_iccsense_create_sensor function. A sensor object will
> only be created for one of those three types and others don't exist.
> I've just added that default statement to shut GCC I think.
> 
> The thing is I reworked that code already and will check if this
> situation still applies there.

OK, thanks for letting me know. Apologies if I burnt up some of your
valuable cycles on this.

Colin

> 
> 2016-06-02 12:28 GMT+02:00 Colin King <colin.king@canonical.com>:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The default sensor->type case leaks memory allocated to rail. Fix
>> this by free'ing rail before we continue with the next loop iteration.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
>> index 323c79a..79b0eb5 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
>> @@ -305,6 +305,7 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
>>                         rail->read = nvkm_iccsense_ina3221_read;
>>                         break;
>>                 default:
>> +                       kfree(rail);
>>                         continue;
>>                 }
>>
>> --
>> 2.8.1
>>
>> _______________________________________________
>> Nouveau mailing list
>> Nouveau@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/nouveau

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

WARNING: multiple messages have this Message-ID (diff)
From: Colin Ian King <colin.king@canonical.com>
To: karol herbst <karolherbst@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>,
	Martin Peres <martin.peres@free.fr>,
	Karol Herbst <nouveau@karolherbst.de>,
	dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case
Date: Fri, 3 Jun 2016 11:42:12 +0100	[thread overview]
Message-ID: <57515F04.8000408@canonical.com> (raw)
In-Reply-To: <CAEXux-ZWRYq_8L=0Ho9DJ+VCYq_Uk=TpvszT01Ms3Lb-fx1u9g@mail.gmail.com>

On 03/06/16 10:55, karol herbst wrote:
> Hi Colin,
> 
> thanks for pointing this out, but I am quite sure this continue
> statement won't ever be hit, ever.
> 
> check the nvkm_iccsense_create_sensor function. A sensor object will
> only be created for one of those three types and others don't exist.
> I've just added that default statement to shut GCC I think.
> 
> The thing is I reworked that code already and will check if this
> situation still applies there.

OK, thanks for letting me know. Apologies if I burnt up some of your
valuable cycles on this.

Colin

> 
> 2016-06-02 12:28 GMT+02:00 Colin King <colin.king@canonical.com>:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The default sensor->type case leaks memory allocated to rail. Fix
>> this by free'ing rail before we continue with the next loop iteration.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
>> index 323c79a..79b0eb5 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
>> @@ -305,6 +305,7 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
>>                         rail->read = nvkm_iccsense_ina3221_read;
>>                         break;
>>                 default:
>> +                       kfree(rail);
>>                         continue;
>>                 }
>>
>> --
>> 2.8.1
>>
>> _______________________________________________
>> Nouveau mailing list
>> Nouveau@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/nouveau

  reply	other threads:[~2016-06-03 10:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 10:28 [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case Colin King
2016-06-02 22:28 ` Ben Skeggs
     [not found] ` <1464863332-9610-1-git-send-email-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2016-06-03  9:55   ` karol herbst
2016-06-03  9:55     ` [Nouveau] " karol herbst
2016-06-03 10:42     ` Colin Ian King [this message]
2016-06-03 10:42       ` Colin Ian King

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=57515F04.8000408@canonical.com \
    --to=colin.king@canonical.com \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karolherbst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@karolherbst.de \
    --cc=nouveau@lists.freedesktop.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 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.