From: Simon Horman <horms@verge.net.au>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: kexec@lists.infradead.org
Subject: Re: [Patch] kexec: fix several issues in get_crash_notes()
Date: Mon, 21 Nov 2011 17:50:58 +0900 [thread overview]
Message-ID: <20111121085057.GB6187@verge.net.au> (raw)
In-Reply-To: <CAM_iQpUFSHrEy9z902iMucEN5EisxdjO=QYtJGkF=f1m6qnAKg@mail.gmail.com>
On Mon, Nov 21, 2011 at 03:43:34PM +0800, Cong Wang wrote:
> On Fri, Nov 18, 2011 at 10:11 AM, Simon Horman <horms@verge.net.au> wrote:
> > On Wed, Nov 16, 2011 at 09:09:26PM +0800, WANG Cong wrote:
> >> a) We don't need 'crash_notes' array at all, save some bytes on stack.
> >> b) We forgot to fclose 'fp' before return.
> >>
> >> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
> >>
> >> ---
> >> diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> >> index 98cda72..333f6ba 100644
> >> --- a/kexec/arch/i386/crashdump-x86.c
> >> +++ b/kexec/arch/i386/crashdump-x86.c
> >> @@ -589,20 +589,18 @@ static int cmdline_add_elfcorehdr(char *cmdline, unsigned long addr)
> >> */
> >> static int get_crash_notes(int cpu, uint64_t *addr, uint64_t *len)
> >> {
> >> - char crash_notes[PATH_MAX];
> >
> > I wonder if the following might reduce memory usage:
> >
> > const char *crash_notes = "/sys/kernel/crash_notes";
>
> Yeah, sure. Below is the new patch.
> -------------------->
>
> a) We don't need 'crash_notes' array at all, save some bytes on stack.
> b) We forgot to fclose 'fp' before return.
Thanks, applied.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2011-11-21 8:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 13:09 [Patch] kexec: fix several issues in get_crash_notes() WANG Cong
2011-11-18 2:11 ` Simon Horman
2011-11-21 7:43 ` Cong Wang
2011-11-21 8:50 ` Simon Horman [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=20111121085057.GB6187@verge.net.au \
--to=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=xiyou.wangcong@gmail.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