]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 May 2024 15:56:14 +0000 (17:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 May 2024 15:56:14 +0000 (17:56 +0200)
added patches:
x86-percpu-use-__force-to-cast-from-__percpu-address-space.patch

queue-6.9/series
queue-6.9/x86-percpu-use-__force-to-cast-from-__percpu-address-space.patch [new file with mode: 0644]

index 5ebd0a2e7ad11d4be41edd663847bf11b1909681..364b6da95499667ad5872fffa985c0916a5cd205 100644 (file)
@@ -3,3 +3,4 @@ wifi-iwlwifi-use-request_module_nowait.patch
 cpufreq-amd-pstate-fix-the-highest-frequency-issue-which-limits-performance.patch
 drm-amd-display-fix-division-by-zero-in-setup_dsc_config.patch
 net-ks8851-fix-another-tx-stall-caused-by-wrong-isr-flag-handling.patch
+x86-percpu-use-__force-to-cast-from-__percpu-address-space.patch
diff --git a/queue-6.9/x86-percpu-use-__force-to-cast-from-__percpu-address-space.patch b/queue-6.9/x86-percpu-use-__force-to-cast-from-__percpu-address-space.patch
new file mode 100644 (file)
index 0000000..aa7b6ff
--- /dev/null
@@ -0,0 +1,56 @@
+From a55c1fdad5f61b4bfe42319694b23671a758cb28 Mon Sep 17 00:00:00 2001
+From: Uros Bizjak <ubizjak@gmail.com>
+Date: Tue, 2 Apr 2024 19:50:38 +0200
+Subject: x86/percpu: Use __force to cast from __percpu address space
+
+From: Uros Bizjak <ubizjak@gmail.com>
+
+commit a55c1fdad5f61b4bfe42319694b23671a758cb28 upstream.
+
+Fix Sparse warning when casting from __percpu address space by using
+__force in the cast. x86 named address spaces are not considered to
+be subspaces of the generic (flat) address space, so explicit casts
+are required to convert pointers between these address spaces and the
+generic address space (the application should cast to uintptr_t and
+apply the segment base offset). The cast to uintptr_t removes
+__percpu address space tag and Sparse reports:
+
+  warning: cast removes address space '__percpu' of expression
+
+Use __force to inform Sparse that the cast is intentional.
+
+Fixes: 9a462b9eafa6 ("x86/percpu: Use compiler segment prefix qualifier")
+Reported-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
+Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Link: https://lore.kernel.org/r/20240402175058.52649-1-ubizjak@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+Closes: https://lore.kernel.org/lkml/CAFGhKbzev7W4aHwhFPWwMZQEHenVgZUj7=aunFieVqZg3mt14A@mail.gmail.com/
+---
+ arch/x86/include/asm/percpu.h |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/include/asm/percpu.h
++++ b/arch/x86/include/asm/percpu.h
+@@ -70,7 +70,7 @@
+       unsigned long tcp_ptr__;                                \
+       tcp_ptr__ = __raw_cpu_read(, this_cpu_off);             \
+                                                               \
+-      tcp_ptr__ += (unsigned long)(ptr);                      \
++      tcp_ptr__ += (__force unsigned long)(ptr);              \
+       (typeof(*(ptr)) __kernel __force *)tcp_ptr__;           \
+ })
+ #else /* CONFIG_USE_X86_SEG_SUPPORT */
+@@ -102,8 +102,8 @@
+ #endif /* CONFIG_SMP */
+ #define __my_cpu_type(var)    typeof(var) __percpu_seg_override
+-#define __my_cpu_ptr(ptr)     (__my_cpu_type(*ptr) *)(uintptr_t)(ptr)
+-#define __my_cpu_var(var)     (*__my_cpu_ptr(&var))
++#define __my_cpu_ptr(ptr)     (__my_cpu_type(*ptr)*)(__force uintptr_t)(ptr)
++#define __my_cpu_var(var)     (*__my_cpu_ptr(&(var)))
+ #define __percpu_arg(x)               __percpu_prefix "%" #x
+ #define __force_percpu_arg(x) __force_percpu_prefix "%" #x