[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgdcA-gADjaqp5KZChRjwKGStOo_MVEu3MSi7HiRDGS9g@mail.gmail.com>
Date: Sun, 27 Dec 2020 09:42:06 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Jon Mason <jdmason@...zu.us>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-ntb@...glegroups.com
Subject: Re: [GIT PULL] NTB bug fixes for v5.11
On Sun, Dec 27, 2020 at 9:38 AM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> The thing is, "PTR_ERR()" works just fine on a IS_ERR_OR_NULL pointer.
> It doesn't work on a _regular_ non-NULL and non-ERR pointer, and will
> return random garbage for those. But if you've tested for
> IS_ERR_OR_NULL(), then a regular PTR_ERR() is already fine.
Side note: no, standard C does not guarantee that a NULL pointer would
cast to the integer 0 (despite a cast of the constant 0 turning into
NULL), but the kernel very much does. And our ERR_PTR() games in
particular already violate all the standard C rules, and we very much
depend on the pointer bit patterns to begin with.
Linus
Powered by blists - more mailing lists