From: Will Deacon <will.deacon@arm.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] nospec: Move array_index_nospec parameter checking into separate macro
Date: Mon, 19 Feb 2018 11:54:53 +0000 [thread overview]
Message-ID: <20180219115452.GC30394@arm.com> (raw)
In-Reply-To: <CAMuHMdU=DybUCyL3S11Uij1sHSoyBoeR3KXZz2A__kvgqVQmQA@mail.gmail.com>
Hi Geert,
On Mon, Feb 19, 2018 at 12:47:08PM +0100, Geert Uytterhoeven wrote:
> On Mon, Feb 5, 2018 at 3:16 PM, Will Deacon <will.deacon@arm.com> wrote:
> > For architectures providing their own implementation of
> > array_index_mask_nospec in asm/barrier.h, attempting to use WARN_ONCE to
> > complain about out-of-range parameters using WARN_ON results in a mess
> > of mutually-dependent include files.
> >
> > Rather than unpick the dependencies, simply have the core code in nospec.h
> > perform the checking for us.
> >
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
[...]
> > @@ -61,7 +67,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
> > ({ \
> > typeof(index) _i = (index); \
> > typeof(size) _s = (size); \
> > - unsigned long _mask = array_index_mask_nospec(_i, _s); \
> > + unsigned long _mask = array_index_mask_nospec_check(_i, _s); \
> > \
> > BUILD_BUG_ON(sizeof(_i) > sizeof(long)); \
> > BUILD_BUG_ON(sizeof(_s) > sizeof(long)); \
>
> This change is commit 8fa80c503b484ddc ("nospec: Move array_index_nospec()
> parameter checking into separate macro") in v4.16-rc2, and triggers the
> following warning with gcc-4.1.2:
>
> net/wireless/nl80211.c: In function ‘parse_txq_params’:
> net/wireless/nl80211.c:2099: warning: comparison is always false
> due to limited range of data type
>
> Reverting the commit gets rid of the warning.
This is all getting ripped out, so stay tuned. The check is bogus, generates
crappy code and I did a poor job at macro-ising it. Apart from that, it's
great.
https://git.kernel.org/tip/1d91c1d2c80cb70e2e553845e278b87a960c04da
Will
prev parent reply other threads:[~2018-02-19 11:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 14:16 [PATCH] nospec: Move array_index_nospec parameter checking into separate macro Will Deacon
2018-02-05 18:54 ` Dan Williams
2018-02-13 15:25 ` [tip:x86/pti] nospec: Move array_index_nospec() " tip-bot for Will Deacon
2018-02-15 0:28 ` tip-bot for Will Deacon
2018-02-19 11:47 ` [PATCH] nospec: Move array_index_nospec " Geert Uytterhoeven
2018-02-19 11:54 ` Will Deacon [this message]
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=20180219115452.GC30394@arm.com \
--to=will.deacon@arm.com \
--cc=arnd@arndb.de \
--cc=dan.j.williams@intel.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/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