mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Seebach <peter.seebach@windriver.com>
To: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/6] workqueue: introduce NR_WORKER_POOLS and for_each_worker_pool()
Date: Mon, 16 Jul 2012 14:31:14 -0500	[thread overview]
Message-ID: <20120716143114.5ad07878@wrlaptop> (raw)
In-Reply-To: <CA+55aFyozbYJh4vRLCCkk5j86XEasngvWkKmL4WpBjiCB5050g@mail.gmail.com>

On Fri, 13 Jul 2012 22:00:10 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> (*) Technically, "&(x)[0]" is actually a really confused way of saying
> "(x+0)" while making sure that "x" was a valid pointer.

But wait, there's more!

Should someone some day try to use an implementation with a fairly
ferocious bounds-checker, the bounds of &x[0] are the bounds of the
first member of x, while the bounds of x are... well, whatever they
were. (If x is an array, they're definitely the bounds of the whole
array. If x is a pointer to something, then it depends on how the
pointer was obtained.)

I'm not sure anyone actually has an implementation that bothers with
this level of granularity in pointers, but I am about 90% sure that an
implementation which did would be conforming.  e.g.:

  int a[2];
  a[1] = 3; /* ok */
  int *b = a;
  b[1] = 3; /* ok */
  int *c = &a[0];
  c[1] = 3; /* bounds violation */

Note that "conforming" does not imply "could compile and run most
existing code without surprising new errors". The world is full of code
which assumes absolute identity between (a+i) and &(*(a+i)).

If the code which inspired your rant was actually doing it on purpose
to obtain this result, I shall have to buy a hat so I can eat it.
(Disclaimer: Hat must be made of something delicious.)

-s
-- 
Listen, get this.  Nobody with a good compiler needs to be justified.

  parent reply	other threads:[~2012-07-16 19:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09 18:41 [PATCHSET] workqueue: reimplement high priority using a separate worker pool Tejun Heo
2012-07-09 18:41 ` [PATCH 1/6] workqueue: don't use WQ_HIGHPRI for unbound workqueues Tejun Heo
2012-07-09 18:41 ` [PATCH 2/6] workqueue: factor out worker_pool from global_cwq Tejun Heo
2012-07-10  4:48   ` Namhyung Kim
2012-07-12 17:07     ` Tejun Heo
2012-07-12 21:49   ` [PATCH UPDATED " Tejun Heo
2012-07-09 18:41 ` [PATCH 3/6] workqueue: use @pool instead of @gcwq or @cpu where applicable Tejun Heo
2012-07-10 23:30   ` Tony Luck
2012-07-12 17:06     ` Tejun Heo
2012-07-09 18:41 ` [PATCH 4/6] workqueue: separate out worker_pool flags Tejun Heo
2012-07-09 18:41 ` [PATCH 5/6] workqueue: introduce NR_WORKER_POOLS and for_each_worker_pool() Tejun Heo
2012-07-14  3:55   ` Tejun Heo
2012-07-14  4:27     ` Linus Torvalds
2012-07-14  4:44       ` Tejun Heo
2012-07-14  5:00         ` Linus Torvalds
2012-07-14  5:07           ` Tejun Heo
2012-07-16 19:31           ` Peter Seebach [this message]
2012-07-14  5:21   ` [PATCH UPDATED " Tejun Heo
2012-07-09 18:41 ` [PATCH 6/6] workqueue: reimplement WQ_HIGHPRI using a separate worker_pool Tejun Heo
2012-07-12 13:06   ` Fengguang Wu
2012-07-12 17:05     ` Tejun Heo
2012-07-12 21:45       ` Tejun Heo
2012-07-12 22:16         ` Tony Luck
2012-07-12 22:32           ` Tejun Heo
2012-07-12 23:24             ` Tony Luck
2012-07-12 23:36               ` Tejun Heo
2012-07-12 23:46                 ` Tony Luck
2012-07-13 17:51                   ` Tony Luck
2012-07-13  2:08         ` Fengguang Wu
2012-07-14  3:41           ` Tejun Heo
2012-07-14  3:56   ` [PATCH UPDATED " Tejun Heo
2012-07-14  8:18     ` Fengguang Wu
2012-07-14  5:24   ` [PATCH UPDATED v3 " Tejun Heo

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=20120716143114.5ad07878@wrlaptop \
    --to=peter.seebach@windriver.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome