nospec: Move array_index_nospec() parameter checking into separate macro
authorWill Deacon <will.deacon@arm.com>
Mon, 5 Feb 2018 14:16:06 +0000 (14:16 +0000)
committerIngo Molnar <mingo@kernel.org>
Thu, 15 Feb 2018 00:15:51 +0000 (01:15 +0100)
commit8fa80c503b484ddc1abbd10c7cb2ab81f3824a50
treeb5b1d8d3cfbb754ca59916900ba1ce50d993a8a2
parentbe3233fbfcb8f5acb6e3bcd0895c3ef9e100d470
nospec: Move array_index_nospec() parameter checking into separate macro

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.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1517840166-15399-1-git-send-email-will.deacon@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/nospec.h