mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Catalin Marinas" <catalin.marinas@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix a memory leak in the i386 setup code
Date: Tue, 11 Jul 2006 10:26:27 +0200	[thread overview]
Message-ID: <200607111026.27821.rjw@sisk.pl> (raw)
In-Reply-To: <b0943d9e0607110047x5f494981h1925c950d34459f0@mail.gmail.com>

On Tuesday 11 July 2006 09:47, Catalin Marinas wrote:
> 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.

Ah, right, it's freed when request_resource(&iomem_resource, res) fails.
Sorry for the noise.

Rafael

  reply	other threads:[~2006-07-11  8:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-10 22:13 Catalin Marinas
2006-07-10 22:25 ` Rafael J. Wysocki
2006-07-11  7:47   ` Catalin Marinas
2006-07-11  8:26     ` Rafael J. Wysocki [this message]
2006-07-10 22:45 ` functions returning 0 on success [was: [PATCH] Fix a memory leak in the i386 setup code] Michael Tokarev
2006-07-10 22:49   ` Michael Tokarev
2006-07-15 17:33   ` Dmitry Torokhov

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=200607111026.27821.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=catalin.marinas@gmail.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®