Re: [GIT PULL] kbuild updates for v4.7-rc1
From: Linus Torvalds
Date: Fri May 27 2016 - 14:28:54 EST
On Fri, May 27, 2016 at 10:23 AM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> This code:
>
> if (IS_ERR(hash))
> return PTR_ERR(hash);
>
> is obviously "return non-zero" to a kernel developer (because that's
> how our error codes work), but to a compiler that "return PTR_ERR()"
> ends up casting a "long" to an "int" return value.
It doesn't help that gfs2 is using the IS_ERR_VALUE() macro on an
"int", whih is bogus to begin with. It happens to *work*, but by the
time you've cast an error pointer to "int", you've lost enough bits
that "IS_ERR_VALUE()" isn't a valid thing to do. You should just check
against zero (possibly against negative).
But fixing that and just checking against a non-zero int doesn't
actually fix the warning.
Linus