From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: Geoff Levand <geoff@infradead.org>
Cc: stefan.roscher@de.ibm.com, Simon Horman <horms@verge.net.au>,
kexec@lists.infradead.org
Subject: Re: [PATCH] kexec: use mmap instead of read for slurp_file()
Date: Thu, 15 Oct 2015 14:31:38 +0200 [thread overview]
Message-ID: <20151015143138.1287fd6f@holzheu> (raw)
In-Reply-To: <1444867552.3929.7.camel@infradead.org>
On Wed, 14 Oct 2015 17:05:52 -0700
Geoff Levand <geoff@infradead.org> wrote:
[snip]
> > if (err < 0)
> > > > > > die("Can not seek to the begin of file %s: %s\n",
> > > > > > > > filename, strerror(errno));
> > +> > > buf = slurp_fd(fd, filename, size, &nread);
> > > > } else {
> > -> > > size = stats.st_size;
> > +> > > size = nread = stats.st_size;
> > +> > > buf = mmap(NULL, size,
>
> With this change the caller can't tell if buf was malloc'ed or mmaped. The
> only safe thing it can do is to not call free() on the returned buf, this will
> lead to memory leakage for malloc'ed buffers.
I have read the code and have not found any free call. Therefore I assumed
that the kexec approach is to not free the buffer *explicitly* and leave to
the kernel to free it *automatically* at process exit.
@Simon: Was this assumption wrong?
Michael
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2015-10-15 12:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 16:17 [RFC PATCH] kexec: use mmap instead of read for slurp_file() Michael Holzheu
2015-08-28 14:26 ` PING: " Michael Holzheu
2015-09-02 1:07 ` Simon Horman
2015-09-02 8:48 ` Michael Holzheu
2015-09-04 9:45 ` Simon Horman
2015-09-04 12:11 ` [PATCH] " Michael Holzheu
2015-09-07 6:44 ` Simon Horman
2015-10-15 0:05 ` Geoff Levand
2015-10-15 12:31 ` Michael Holzheu [this message]
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=20151015143138.1287fd6f@holzheu \
--to=holzheu@linux.vnet.ibm.com \
--cc=geoff@infradead.org \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=stefan.roscher@de.ibm.com \
/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