[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACAvsv7r5wEiTpzbHZKNCdG3ueF8BR6EPe-bi2LR9FcrDN+kBQ@mail.gmail.com>
Date: Mon, 4 Jul 2011 09:46:51 +1000
From: Ben Skeggs <skeggsb@...il.com>
To: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Jesper Juhl <jj@...osbits.net>,
Paul Menzel <paulepanter@...rs.sourceforge.net>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nouveau: Do not leak in nv20_graph_create
On Mon, Jul 4, 2011 at 12:39 AM, Marcin Slusarz
<marcin.slusarz@...il.com> wrote:
> On Sun, Jul 03, 2011 at 01:21:55PM +0200, Jesper Juhl wrote:
>> From: Jesper Juhl <jj@...osbits.net>
>> Subject: [PATCH] nouveau: Do not leak in nv20_graph_create
>>
>> If we return due to an unknown chipset in drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the memory allocated to 'pgraph'.
>>
>> This patch should fix the leak and it also disambiguates the "PGRAPH:
>> unknown chipset\n" error message - it's nice to be able to tell which
>> branch created the error which is impossible if the error messages are
>> 100% identical.
>
> There's no need to change these strings. Nouveau prints chipset id earlier.
> For patch with only kfrees:
> Reviewed-by: Marcin Slusarz <marcin.slusarz@...il.com>
Agreed, I've pulled just the kfree()s into my tree. They'll hit
nouveau git either today or tomorrow.
Thank you!
Ben.
>
>> Signed-off-by: Jesper Juhl <jj@...osbits.net>
>> ---
>> drivers/gpu/drm/nouveau/nv20_graph.c | 4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c
>> index affc7d7..53cbe84 100644
>> --- a/drivers/gpu/drm/nouveau/nv20_graph.c
>> +++ b/drivers/gpu/drm/nouveau/nv20_graph.c
>> @@ -752,6 +752,7 @@ nv20_graph_create(struct drm_device *dev)
>> pgraph->grctx_user = 0x0000;
>> break;
>> default:
>> + kfree(pgraph);
>> NV_ERROR(dev, "PGRAPH: unknown chipset\n");
>> return 0;
>> }
>> @@ -773,7 +774,8 @@ nv20_graph_create(struct drm_device *dev)
>> pgraph->grctx_size = NV35_36_GRCTX_SIZE;
>> break;
>> default:
>> - NV_ERROR(dev, "PGRAPH: unknown chipset\n");
>> + kfree(pgraph);
>> + NV_ERROR(dev, "PGRAPH: chipset unknown.\n");
>> return 0;
>> }
>> }
>> --
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists