The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Marcus Alanen <maalanen@ra.abo.fi>
Cc: perex@suse.cz, linux-kernel@vger.kernel.org
Subject: Re: [patch] request_region / release_resource mixup
Date: Tue, 12 Feb 2002 01:49:57 -0500	[thread overview]
Message-ID: <3C68BB15.AF27E615@mandrakesoft.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0202091708230.1410-100000@tuxedo.abo.fi>

Marcus Alanen wrote:
> 
> Hi, looking at region and resource handling I see that request_region
> allocates the struct resource with kmalloc() while request_resource
> takes it as a parameter. This means that release_region uses kfree()
> and release_resource doesn't.
> 
> There are some drivers which mix this up by doing a request_region /
> release_resource pair, instead of the proper request_region /
> release_region. This leads to a memory leak.
> 
> I've tried to fix this below. Comments? Output is from bk diff -u,
> not sure what the best command would've been.

Good patch, but a comment.  When you replace release_resource(res) with
release_region(), you should also look and see if you can eliminate the
temporary variable 'res' too.

-- 
Jeff Garzik      | "I went through my candy like hot oatmeal
Building 1024    |  through an internally-buttered weasel."
MandrakeSoft     |             - goats.com

  reply	other threads:[~2002-02-12  6:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-09 15:21 [patch] request_region / release_resource mixup Marcus Alanen
2002-02-12  6:49 ` Jeff Garzik [this message]
2002-02-12 20:03   ` Marcus Alanen

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=3C68BB15.AF27E615@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maalanen@ra.abo.fi \
    --cc=perex@suse.cz \
    /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