lkml.org 
[lkml]   [2006]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix a memory leak in the i386 setup code
On 10/07/06, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> Does x86_64 need a similar fix?

Doesn't look like it needs this.

> On Tuesday 11 July 2006 00:13, Catalin Marinas wrote:
> > --- a/arch/i386/kernel/setup.c
> > +++ b/arch/i386/kernel/setup.c
> > @@ -1327,7 +1327,10 @@ #endif
> > res->start = e820.map[i].addr;
> > res->end = res->start + e820.map[i].size - 1;
> > res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
> > - request_resource(&iomem_resource, res);
> > + if (request_resource(&iomem_resource, res)) {
> > + kfree(res);
> > + continue;
> > + }
> > if (e820.map[i].type == E820_RAM) {
> > /*
> > * We don't know which RAM region contains kernel data,
>
> Evidently res is used if e820.map[i].type == E820_RAM, so it should
> be freed later on, it seems.

The "if" block I added has a "continue" and therefore the E820_RAM
case is skipped. There is no point in requesting a resource with "res"
as parent when "res" couldn't be successfully acquired.

--
Catalin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-11 09:51    [W:0.060 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site