Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1412105 > unrolled thread

[PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case

Started byColin King <colin.king@canonical.com>
First post2016-06-02 12:30 +0200
Last post2016-06-03 12:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case Colin King <colin.king@canonical.com> - 2016-06-02 12:30 +0200
    Re: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on  default sensor->type case karol herbst <karolherbst@gmail.com> - 2016-06-03 12:00 +0200
      Re: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on  default sensor->type case Colin Ian King <colin.king@canonical.com> - 2016-06-03 12:50 +0200

#1412105 — [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case

FromColin King <colin.king@canonical.com>
Date2016-06-02 12:30 +0200
Subject[PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case
Message-ID<rFy2Z-4Jw-23@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1412985 — Re: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case

Fromkarol herbst <karolherbst@gmail.com>
Date2016-06-03 12:00 +0200
SubjectRe: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case
Message-ID<rFU3v-1wB-5@gated-at.bofh.it>
In reply to#1412105
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.

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

[toc] | [prev] | [next] | [standalone]


#1413043 — Re: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case

FromColin Ian King <colin.king@canonical.com>
Date2016-06-03 12:50 +0200
SubjectRe: [Nouveau] [PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case
Message-ID<rFUPU-21R-29@gated-at.bofh.it>
In reply to#1412985
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web