Re: [linux-next:master 5741/5912] kernel/crash_core.c:214:13: warning: argument 2 null where non-null expected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/19/23 at 06:16pm, Andrew Morton wrote:
> On Wed, 20 Sep 2023 07:11:45 +0800 Baoquan He <bhe@xxxxxxxxxx> 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.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux