提交 bdb5ac80 编写于 作者: A Andrey Ryabinin 提交者: Linus Torvalds

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: NAndrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d8a5b805
...@@ -185,23 +185,21 @@ void __read_once_size(const volatile void *p, void *res, int size) ...@@ -185,23 +185,21 @@ void __read_once_size(const volatile void *p, void *res, int size)
#ifdef CONFIG_KASAN #ifdef CONFIG_KASAN
/* /*
* This function is not 'inline' because __no_sanitize_address confilcts * We can't declare function 'inline' because __no_sanitize_address confilcts
* with inlining. Attempt to inline it may cause a build failure. * with inlining. Attempt to inline it may cause a build failure.
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
* '__maybe_unused' allows us to avoid defined-but-not-used warnings. * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
*/ */
static __no_sanitize_address __maybe_unused # define __no_kasan_or_inline __no_sanitize_address __maybe_unused
void __read_once_size_nocheck(const volatile void *p, void *res, int size)
{
__READ_ONCE_SIZE;
}
#else #else
static __always_inline # define __no_kasan_or_inline __always_inline
#endif
static __no_kasan_or_inline
void __read_once_size_nocheck(const volatile void *p, void *res, int size) void __read_once_size_nocheck(const volatile void *p, void *res, int size)
{ {
__READ_ONCE_SIZE; __READ_ONCE_SIZE;
} }
#endif
static __always_inline void __write_once_size(volatile void *p, void *res, int size) static __always_inline void __write_once_size(volatile void *p, void *res, int size)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册