linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Baoquan He <bhe@redhat.com>
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: Tue, 19 Sep 2023 18:16:21 -0700	[thread overview]
Message-ID: <20230919181621.382be43e97f51effb47ab412@linux-foundation.org> (raw)
In-Reply-To: <ZQoqsV3xLvQuGW1d@MiWiFi-R3L-srv>

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.


  reply	other threads:[~2023-09-20  1:16 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 [this message]
2023-09-20  1:36       ` Baoquan He

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=20230919181621.382be43e97f51effb47ab412@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --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