From: Pingfan Liu <kernelfans@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Baoquan He <bhe@redhat.com>, Will Deacon <will.deacon@arm.com>,
Nicolas Pitre <nico@linaro.org>, Vivek Goyal <vgoyal@redhat.com>,
Chao Fan <fanc.fnst@cn.fujitsu.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Hari Bathini <hbathini@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/2] x86/boot/KASLR: skip the specified crashkernel region
Date: Thu, 18 Apr 2019 15:56:09 +0800 [thread overview]
Message-ID: <CAFgQCTsPGp3vwDYndXR2Qk=t2X9Gqg-82KicoAKLon+TgkkAWg@mail.gmail.com> (raw)
In-Reply-To: <20190417160618.GG20492@zn.tnic>
On Thu, Apr 18, 2019 at 12:06 AM Borislav Petkov <bp@alien8.de> wrote:
>
> On Wed, Apr 17, 2019 at 01:53:37PM +0800, Pingfan Liu wrote:
> > Take __parse_crashkernel()->parse_crashkernel_simple() for example. If
> > no offset given, then it still return 0, but crash_base is dangling.
Sorry for misleading, I made a mistake. In
parse_crashkernel()->__parse_crashkernel(), { *crash_size = 0;
*crash_base = 0;}. Hence no need to initialize crash_base in
handle_crashkernel_options().
>
> Well, that is bad design. parse_crashkernel_simple() should return a
> *separate* distinct value which denotes that @offset hasn't been passed.
Then in my case, either no @offset or invalid argument will keep
"*crash_base = 0", and KASLR does not care about either of them.
>
> Please fix that by having it return 1 or something else positive to
> denote that there wasn't an [@offset] given.
>
> And then correct that crap here:
>
> static void __init reserve_crashkernel(void)
> {
> ...
>
> ret = parse_crashkernel(boot_command_line, total_mem, &crash_size, &crash_base);
> if (ret != 0 || crash_size <= 0) {
It is not elegant. Will try a separate patch to fix it firstly.
Thanks,
Pingfan
>
> where *two*! variables are used as return values from a single function.
> That's just sloppy.
>
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> Good mailing practices for 400: avoid top-posting and trim the reply.
next prev parent reply other threads:[~2019-04-18 7:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 5:58 [PATCH v4 0/2] x86/boot/KASLR: skip the specified crashkernel region Pingfan Liu
2019-04-08 5:58 ` [PATCH v4 1/2] kernel/crash_core: separate the parsing routines to lib/parse_crashkernel.c Pingfan Liu
2019-04-16 19:01 ` Borislav Petkov
2019-04-17 5:48 ` Pingfan Liu
2019-04-08 5:58 ` [PATCH v4 2/2] x86/boot/KASLR: skip the specified crashkernel region Pingfan Liu
2019-04-16 19:01 ` Borislav Petkov
2019-04-17 5:53 ` Pingfan Liu
2019-04-17 16:06 ` Borislav Petkov
2019-04-18 7:56 ` Pingfan Liu [this message]
2019-04-18 12:32 ` Borislav Petkov
2019-05-06 10:08 ` Pingfan Liu
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='CAFgQCTsPGp3vwDYndXR2Qk=t2X9Gqg-82KicoAKLon+TgkkAWg@mail.gmail.com' \
--to=kernelfans@gmail.com \
--cc=ard.biesheuvel@linaro.org \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=fanc.fnst@cn.fujitsu.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nico@linaro.org \
--cc=tglx@linutronix.de \
--cc=vgoyal@redhat.com \
--cc=will.deacon@arm.com \
--cc=x86@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;
as well as URLs for NNTP newsgroup(s).