From: Thomas Renninger <trenn@suse.de>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: linux-acpi@vger.kernel.org, Len Brown <lenb@kernel.org>,
Bjorn Helgaas <bjorn.helgaas@hp.com>,
Rene Herman <rene.herman@keyaccess.nl>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Allocate pnp resources dynamically via krealloc
Date: Sun, 20 Jan 2008 12:04:26 +0100 [thread overview]
Message-ID: <1200827066.3713.4.camel@queen> (raw)
In-Reply-To: <84144f020801191623i2ad344a8t1c40969578793d13@mail.gmail.com>
On Sun, 2008-01-20 at 02:23 +0200, Pekka Enberg wrote:
> Hi Thomas,
>
> On Jan 19, 2008 10:00 PM, Thomas Renninger <trenn@suse.de> wrote:
> > +static int pnp_alloc_port(struct pnp_resource_table *res)
> > +{
>
> [snip]
>
> > + res->port_resource = krealloc(res->port_resource,
> > + (sizeof(struct resource) * res->allocated_ports)
> > + + (sizeof(struct resource) * PNP_ALLOC_PORT), GFP_KERNEL);
> > +
> > + if (!res->port_resource)
> > + return -ENOMEM;
>
> When krealloc() returns NULL, there wasn't enough memory to fit the
> new size but the original memory region remains unchanged. Therefore
> you must not unconditionally overwrite the res->port_resource with the
> return value of krealloc(); otherwise you might leak memory.
>
Thanks.
While looking at this I found something else..., I think I sent an old
version.
Please hold off, I will double check and resend soon.
Thomas
next prev parent reply other threads:[~2008-01-20 11:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-19 20:00 [PATCH] Allocate pnp resources dynamically via krealloc Thomas Renninger
2008-01-20 0:23 ` Pekka Enberg
2008-01-20 11:04 ` Thomas Renninger [this message]
2008-01-23 17:38 ` [PATCH] Allocate pnp resources dynamically via krealloc - working version Thomas Renninger
2008-01-27 19:19 ` Rene Herman
2008-01-28 14:21 ` Thomas Renninger
2008-01-28 15:00 ` Rene Herman
2008-01-28 16:04 ` [PATCH] Allocate pnp resources dynamically via krealloc - working version - Addon patch 1 Thomas Renninger
2008-01-28 18:07 ` Rene Herman
2008-01-28 19:12 ` [PATCH] Allocate pnp resources dynamically via krealloc - working version - Addon patch 3 Thomas Renninger
2008-01-28 21:12 ` Rene Herman
2008-01-29 14:18 ` [PATCH] Allocate pnp resources dynamically via krealloc - working version - Addon debug patch 4 Thomas Renninger
2008-02-05 18:20 ` [PATCH] Allocate pnp resources dynamically via krealloc - Yet another Version Thomas Renninger
2008-02-06 14:38 ` Thomas Renninger
2008-02-06 15:22 ` Rene Herman
2008-01-28 16:04 ` [PATCH] Allocate pnp resources dynamically via krealloc - working version - Addon patch 2 Thomas Renninger
2008-01-27 21:03 ` [PATCH] Allocate pnp resources dynamically via krealloc - working version Pekka Enberg
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=1200827066.3713.4.camel@queen \
--to=trenn@suse.de \
--cc=bjorn.helgaas@hp.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
--cc=rene.herman@keyaccess.nl \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.