From: Pingfan Liu <kernelfans@gmail.com>
To: Dave Young <dyoung@redhat.com>
Cc: Matthias Brugger <mbrugger@suse.com>,
LKML <linux-kernel@vger.kernel.org>,
Rich Felker <dalias@libc.org>,
linux-ia64@vger.kernel.org,
Julien Thierry <julien.thierry@arm.com>,
Yangtao Li <tiny.windzz@gmail.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Palmer Dabbelt <palmer@sifive.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
x86@kernel.org, linux-mips@vger.kernel.org,
Paul Mackerras <paulus@samba.org>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-s390@vger.kernel.org,
Florian Fainelli <f.fainelli@gmail.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
linux-sh@vger.kernel.org, Michael Ellerman <mpe@ellerman.id.au>,
David Hildenbrand <david@redhat.com>,
Russell King <linux@armlinux.org.uk>,
Ingo Molnar <mingo@redhat.com>,
linux-arm-kernel@lists.infradead.org,
Catalin Marinas <catalin.marinas@arm.com>,
James Hogan <jhogan@kernel.org>,
Fenghua Yu <fenghua.yu@intel.com>,
Will Deacon <will.deacon@arm.com>,
linuxppc-dev@lists.ozlabs.org,
Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
Borislav Petkov <bp@alien8.de>, Stefan Agner <stefan@agner.ch>,
Thomas Gleixner <tglx@linutronix.de>,
Hari Bathini <hbathini@linux.ibm.com>,
Jens Axboe <axboe@kernel.dk>, Tony Luck <tony.luck@intel.com>,
Baoquan He <bhe@redhat.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Robin Murphy <robin.murphy@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ralf Baechle <ralf@linux-mips.org>,
Thomas Bogendoerfer <tbogendoerfer@suse.de>,
Paul Burton <paul.burton@mips.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Logan Gunthorpe <logang@deltatee.com>,
Greg Hackmann <ghackmann@android.com>,
kexec@lists.infradead.org
Subject: Re: [PATCHv2] kernel/crash: make parse_crashkernel()'s return value more indicant
Date: Mon, 29 Apr 2019 11:04:49 +0800 [thread overview]
Message-ID: <CAFgQCTvQezGM7xgY2Q1RSUiQ7wLdxtUAeztrO3AqDfjx8f2kdg@mail.gmail.com> (raw)
In-Reply-To: <20190428083710.GA11981@dhcp-128-65.nay.redhat.com>
On Sun, Apr 28, 2019 at 4:37 PM Dave Young <dyoung@redhat.com> wrote:
>
> On 04/25/19 at 04:20pm, Pingfan Liu wrote:
> > On Wed, Apr 24, 2019 at 4:31 PM Matthias Brugger <mbrugger@suse.com> wrote:
> > >
> > >
> > [...]
> > > > @@ -139,6 +141,8 @@ static int __init parse_crashkernel_simple(char *cmdline,
> > > > pr_warn("crashkernel: unrecognized char: %c\n", *cur);
> > > > return -EINVAL;
> > > > }
> > > > + if (*crash_size == 0)
> > > > + return -EINVAL;
> > >
> > > This covers the case where I pass an argument like "crashkernel=0M" ?
> > > Can't we fix that by using kstrtoull() in memparse and check if the return value
> > > is < 0? In that case we could return without updating the retptr and we will be
> > > fine.
> > >
> > It seems that kstrtoull() treats 0M as invalid parameter, while
> > simple_strtoull() does not.
> >
> > If changed like your suggestion, then all the callers of memparse()
> > will treats 0M as invalid parameter. This affects many components
> > besides kexec. Not sure this can be done or not.
>
> simple_strtoull is obsolete, move to kstrtoull is the right way.
>
> $ git grep memparse|wc
> 158 950 10479
>
> Except some documentation/tools etc there are still a log of callers
> which directly use the return value as the ull number without error
> checking.
>
> So it would be good to mark memparse as obsolete as well in
> lib/cmdline.c, and introduce a new function eg. kmemparse() to use
> kstrtoull, and return a real error code, and save the size in an
> argument like &size. Then update X86 crashkernel code to use it.
>
Thank for your good suggestion.
Regards,
Pingfan
next prev parent reply other threads:[~2019-04-29 3:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 6:33 [PATCHv2] kernel/crash: make parse_crashkernel()'s return value more indicant Pingfan Liu
2019-04-24 8:31 ` Matthias Brugger
2019-04-25 8:20 ` Pingfan Liu
2019-04-28 8:37 ` Dave Young
2019-04-29 3:04 ` Pingfan Liu [this message]
2019-04-29 4:48 ` Pingfan Liu
2019-04-29 5:04 ` Dave Young
2019-05-02 6:22 ` Pingfan Liu
2019-05-24 3:11 ` 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=CAFgQCTvQezGM7xgY2Q1RSUiQ7wLdxtUAeztrO3AqDfjx8f2kdg@mail.gmail.com \
--to=kernelfans@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ananth@linux.vnet.ibm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=axboe@kernel.dk \
--cc=benh@kernel.crashing.org \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=dalias@libc.org \
--cc=david@redhat.com \
--cc=dyoung@redhat.com \
--cc=f.fainelli@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=ghackmann@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=hbathini@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=jhogan@kernel.org \
--cc=julien.thierry@arm.com \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=logang@deltatee.com \
--cc=mbrugger@suse.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=palmer@sifive.com \
--cc=paul.burton@mips.com \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=robin.murphy@arm.com \
--cc=schwidefsky@de.ibm.com \
--cc=stefan@agner.ch \
--cc=tbogendoerfer@suse.de \
--cc=tglx@linutronix.de \
--cc=tiny.windzz@gmail.com \
--cc=tony.luck@intel.com \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
--cc=ysato@users.sourceforge.jp \
/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).