All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: David Laight <David.Laight@aculab.com>
Cc: Christian Brauner <brauner@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] pid: use flex array
Date: Fri, 30 Jun 2023 09:01:54 -0700	[thread overview]
Message-ID: <CAHk-=whY5wuS0QRtEym4d8D2hrNE3pSL9LfoHpSOUKHb2sZtjA@mail.gmail.com> (raw)
In-Reply-To: <8b73a39a359b4523a053efd614cd7dd7@AcuMS.aculab.com>

On Fri, 30 Jun 2023 at 04:21, David Laight <David.Laight@aculab.com> wrote:
>
> The bit pattern used for a NULL pointer is implementation defined.

Oh, pretty much everything we do in the kernel is implementation defined.

And yes, we do indeed basically rely on the bit pattern for NULL being
all zeroes, and that example I gave with PCI_IOBASE is just one of
many.

And yes, compilers will sometimes complain about the things we do.

On s390, for example, the low memory range is special (and the kernel
mapping is special), so s390 uses all these pointers that are
*literally* small constants, and we've had to turn off some compiler
warnings because gcc would think that we're doing small offsets off
NULL.

But "implementation defined" is actually the good case.

The problem case is "undefined", when we sometimes want to do exactly
those kinds of things. We try to generally avoid it, but we sometimes
end up using compiler switches to say "turn off that part of your
logic" (strict overflow comes to mind).

             Linus

  reply	other threads:[~2023-06-30 16:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 10:37 [GIT PULL] pid: use flex array Christian Brauner
2023-06-29 23:52 ` Linus Torvalds
2023-06-30  6:51   ` Christian Brauner
2023-06-30  7:12     ` Linus Torvalds
2023-06-30  8:04       ` Christian Brauner
2023-06-30 11:21         ` David Laight
2023-06-30 16:01           ` Linus Torvalds [this message]
2023-06-30 16:59         ` Kees Cook
2023-07-01  6:27           ` Christian Brauner
2023-07-01  6:44           ` [PATCH] pid: use struct_size_t() helper Christian Brauner
2023-07-01 15:28             ` Linus Torvalds

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='CAHk-=whY5wuS0QRtEym4d8D2hrNE3pSL9LfoHpSOUKHb2sZtjA@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=David.Laight@aculab.com \
    --cc=brauner@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.