From: Baoquan He <bhe@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <lkp@intel.com>,
oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Zhen Lei <thunder.leizhen@huawei.com>
Subject: Re: [linux-next:master 5741/5912] kernel/crash_core.c:214:13: warning: argument 2 null where non-null expected
Date: Wed, 20 Sep 2023 09:36:41 +0800 [thread overview]
Message-ID: <ZQpMqbNvjZxX/aDJ@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20230919181621.382be43e97f51effb47ab412@linux-foundation.org>
On 09/19/23 at 06:16pm, Andrew Morton wrote:
> On Wed, 20 Sep 2023 07:11:45 +0800 Baoquan He <bhe@redhat.com> wrote:
>
> > >
> > > ret = __parse_crashkernel(cmdline, system_ram, crash_size,
> > > crash_base, NULL);
> > >
> > > and that suffix==NULL gets passed through to the strncmp()?
> >
> > Yeah, this looks like a false positive report. I reproduced this, below
> > change can mute the warning. However, the null pointer checking has been
> > done in __parse_crashkernel() when calls parse_crashkernel_suffix().
>
> How the heck did I miss that.
>
> > Add below check anyway to satisfy the W=1 compiling?
>
> I dunno, gcc is so wrong here I'm inclined to leave it as-is, because
> surely this will get fixed in later gcc's.
>
> > --- a/kernel/crash_core.c
> > +++ b/kernel/crash_core.c
> > @@ -204,6 +204,9 @@ static int __init parse_crashkernel_suffix(char *cmdline,
> > {
> > char *cur = cmdline;
> >
> > + if(!suffix)
> > + return -EINVAL;
> > +
> > *crash_size = memparse(cmdline, &cur);
> > if (cmdline == cur) {
> > pr_warn("crashkernel: memory value expected\n");
>
> If we were to do this, let's have a comment explaining why we're doing
> it - otherwise helpful people will try to remove it again.
I will post v4 patchset anyway to include another fixing in patch 6/9
since LKP spotted a real issue causing compiling warning. I can add this
change with a comment to explain why the checking is needed here.
prev parent reply other threads:[~2023-09-20 1:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 4:02 kernel test robot
2023-09-19 16:42 ` Andrew Morton
2023-09-19 23:11 ` Baoquan He
2023-09-20 1:16 ` Andrew Morton
2023-09-20 1:36 ` Baoquan He [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=ZQpMqbNvjZxX/aDJ@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=thunder.leizhen@huawei.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