READ_ONCE_NOCHECK() unconditionally performs a sizeof(long)-sized access,
so enforce that the size of the pointed-to object that we are loading
from is the same size as 'long'.
Reported-by: Marco Elver <elver@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
*/
#define READ_ONCE_NOCHECK(x) \
({ \
- unsigned long __x = __read_once_word_nocheck(&(x)); \
+ unsigned long __x; \
+ compiletime_assert(sizeof(x) == sizeof(__x), \
+ "Unsupported access size for READ_ONCE_NOCHECK()."); \
+ __x = __read_once_word_nocheck(&(x)); \
smp_read_barrier_depends(); \
- __x; \
+ (typeof(x))__x; \
})
static __no_kasan_or_inline