From 79ca5d72715e8ea8fcefd402313a468aee2349f8 Mon Sep 17 00:00:00 2001 From: Atlas <46817089+AzeAstro@users.noreply.github.com> Date: Tue, 28 May 2024 12:05:38 +0400 Subject: [PATCH] Thread info fix --- include/linux/thread_info.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 8d8821b36..762f379bd 100755 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -138,6 +138,11 @@ static __always_inline bool check_copy_size(const void *addr, size_t bytes, bool is_source) { int sz = __compiletime_object_size(addr); + + /* constant propagation doesn't work well with -Og */ + if (IS_ENABLED(CONFIG_CC_OPTIMIZE_FOR_DEBUGGING)) + return true; + if (unlikely(sz >= 0 && sz < bytes)) { if (!__builtin_constant_p(bytes)) copy_overflow(sz, bytes);