diff options
author | Andrey Ryabinin <aryabinin@virtuozzo.com> | 2018-02-01 13:00:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-01 15:20:21 -0500 |
commit | bdb5ac801af3d81d36732c2f640d6a1d3df83826 (patch) | |
tree | 9ce7392f17b943c51c08ed1ff25eb65152bdd580 | |
parent | d8a5b80568a9cb66810e75b182018e9edb68e8ff (diff) |
compiler.h, kasan: Avoid duplicating __read_once_size_nocheck()
Instead of having two identical __read_once_size_nocheck() functions
with different attributes, consolidate all the difference in new macro
__no_kasan_or_inline and use it. No functional changes.
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/compiler.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 52e611ab9a6c..3035990a8070 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -185,23 +185,21 @@ void __read_once_size(const volatile void *p, void *res, int size) | |||
185 | 185 | ||
186 | #ifdef CONFIG_KASAN | 186 | #ifdef CONFIG_KASAN |
187 | /* | 187 | /* |
188 | * This function is not 'inline' because __no_sanitize_address confilcts | 188 | * We can't declare function 'inline' because __no_sanitize_address confilcts |
189 | * with inlining. Attempt to inline it may cause a build failure. | 189 | * with inlining. Attempt to inline it may cause a build failure. |
190 | * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 | 190 | * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 |
191 | * '__maybe_unused' allows us to avoid defined-but-not-used warnings. | 191 | * '__maybe_unused' allows us to avoid defined-but-not-used warnings. |
192 | */ | 192 | */ |
193 | static __no_sanitize_address __maybe_unused | 193 | # define __no_kasan_or_inline __no_sanitize_address __maybe_unused |
194 | void __read_once_size_nocheck(const volatile void *p, void *res, int size) | ||
195 | { | ||
196 | __READ_ONCE_SIZE; | ||
197 | } | ||
198 | #else | 194 | #else |
199 | static __always_inline | 195 | # define __no_kasan_or_inline __always_inline |
196 | #endif | ||
197 | |||
198 | static __no_kasan_or_inline | ||
200 | void __read_once_size_nocheck(const volatile void *p, void *res, int size) | 199 | void __read_once_size_nocheck(const volatile void *p, void *res, int size) |
201 | { | 200 | { |
202 | __READ_ONCE_SIZE; | 201 | __READ_ONCE_SIZE; |
203 | } | 202 | } |
204 | #endif | ||
205 | 203 | ||
206 | static __always_inline void __write_once_size(volatile void *p, void *res, int size) | 204 | static __always_inline void __write_once_size(volatile void *p, void *res, int size) |
207 | { | 205 | { |