Skip to content

Commit 9701c9f

Browse files
arndbakpm00
authored andcommitted
kasan: mark addr_has_metadata __always_inline
Patch series "objtool warning fixes", v2. These are three of the easier fixes for objtool warnings around kasan/kmsan/kcsan. I dropped one patch since Peter had come up with a better fix, and adjusted the changelog text based on feedback. This patch (of 3): When the compiler decides not to inline this function, objtool complains about incorrect UACCESS state: mm/kasan/generic.o: warning: objtool: __asan_load2+0x11: call to addr_has_metadata() with UACCESS enabled Link: https://lore.kernel.org/all/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Marco Elver <[email protected]> Reviewed-by: Andrey Konovalov <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Kuan-Ying Lee <[email protected]> Cc: Vincenzo Frascino <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent f7a449f commit 9701c9f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/kasan/kasan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
297297
<< KASAN_SHADOW_SCALE_SHIFT);
298298
}
299299

300-
static inline bool addr_has_metadata(const void *addr)
300+
static __always_inline bool addr_has_metadata(const void *addr)
301301
{
302302
return (kasan_reset_tag(addr) >=
303303
kasan_shadow_to_mem((void *)KASAN_SHADOW_START));
@@ -316,7 +316,7 @@ bool kasan_check_range(unsigned long addr, size_t size, bool write,
316316

317317
#else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
318318

319-
static inline bool addr_has_metadata(const void *addr)
319+
static __always_inline bool addr_has_metadata(const void *addr)
320320
{
321321
return (is_vmalloc_addr(addr) || virt_addr_valid(addr));
322322
}

0 commit comments

Comments
 (0)