From: Pingfan Liu <kernelfans@gmail.com>
To: Matthias Brugger <mbrugger@suse.com>
Cc: 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>, Dave Young <dyoung@redhat.com>,
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>
Subject: Re: [PATCHv2] kernel/crash: make parse_crashkernel()'s return value more indicant
Date: Fri, 24 May 2019 11:11:13 +0800 [thread overview]
Message-ID: <CAFgQCTuAEbST8ZdSJmPDTPbqkL3uZ8j6U-vTWT879wARDhUwTw@mail.gmail.com> (raw)
In-Reply-To: <CAFgQCTtQm7SuBRfXik6B065Aa+uQ=Mx6i+Y1q+NJU1GEiUgH4g@mail.gmail.com>
Matthias, ping? Any suggestions?
Thanks,
Pingfan
On Thu, May 2, 2019 at 2:22 PM Pingfan Liu <kernelfans@gmail.com> wrote:
>
> On Thu, Apr 25, 2019 at 4:20 PM Pingfan Liu <kernelfans@gmail.com> 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.
> After a series of work, I suddenly realized that it can not be done
> like this way. "0M" causes kstrtoull() to return -EINVAL, but this is
> caused by "M", not "0". If passing "0" to kstrtoull(), it will return
> 0 on success.
>
> > >
> > It seems that kstrtoull() treats 0M as invalid parameter, while
> > simple_strtoull() does not.
> >
> My careless going through the code. And I tested with a valid value
> "256M" using kstrtoull(), it also returned -EINVAL.
>
> So I think there is no way to distinguish 0 from a positive value
> inside this basic math function.
> Do I miss anything?
>
> Thanks and regards,
> Pingfan
prev parent reply other threads:[~2019-05-24 3:11 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
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 [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=CAFgQCTuAEbST8ZdSJmPDTPbqkL3uZ8j6U-vTWT879wARDhUwTw@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=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).