Re: linux-next: build warning after merge of the net tree

From: Stephen Rothwell
Date: Thu Dec 05 2019 - 18:48:33 EST


Hi Dave,

On Thu, 05 Dec 2019 14:57:39 -0800 (PST) David Miller <davem@xxxxxxxxxxxxx> wrote:
>
> I think it is a false positive as well. It looks like the compiler
> has trouble seeing through ptr error guards.
>
> In the new code the compiler can only see that the return value in the
> error case is non-zero, not necessarily that it is < 0 which is the
> guard against uninitialized accesses of 'obj'.
>
> It will satisfy this property, but through the various casts and
> implicit demotions, this information is lost on the compiler.
>
> My compiler didn't emit this warning FWIW.
>
> gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
>
> I'm unsure how to handle this, setting 'n' to explicitly be NULL
> is bogus because the compiler now will think that a NULL deref
> happens since the guard isn't guarding the existing assignment.

Yeah, not much we can do.

x86_64-linux-gnu-gcc (Debian 9.2.1-19) 9.2.1 20191109

--
Cheers,
Stephen Rothwell

Attachment: pgpN21C5hZZXR.pgp
Description: OpenPGP digital signature