* [PATCH] x86: math-emu: fix div_Xsig prototype
@ 2025-08-07 20:53 Arnd Bergmann
2025-11-09 23:04 ` [tip: x86/build] x86/math-emu: Fix div_Xsig() prototype tip-bot2 for Arnd Bergmann
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2025-08-07 20:53 UTC (permalink / raw)
To: Bill Metzenthen, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, Nathan Chancellor
Cc: Arnd Bergmann, H. Peter Anvin, Nick Desaulniers, Bill Wendling,
Justin Stitt, linux-kernel, llvm
From: Arnd Bergmann <arnd@arndb.de>
The third argument of div_Xsig() is the output of the division, but is marked
'const', which means the compiler is not expecting it to be updated and may
generate bad code around the call. clang-21 now warns about the pattern since
an uninitialized variable is passed into two 'const' arguments by reference:
arch/x86/math-emu/poly_atan.c:93:28: error: variable 'argSignif' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
93 | div_Xsig(&Numer, &Denom, &argSignif);
| ^~~~~~~~~
arch/x86/math-emu/poly_l2.c:195:29: error: variable 'argSignif' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
195 | div_Xsig(&Numer, &Denom, &argSignif);
| ^~~~~~~~~
The implementation is in assembly, so the problem has gone unnoticed since the
code was added in the linux-1.1 days. Remove the 'const' marker here.
Fixes: e19a1bdb835c ("Import 1.1.38")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/math-emu/poly.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/math-emu/poly.h b/arch/x86/math-emu/poly.h
index fc1c887ca073..654bfe4e29a0 100644
--- a/arch/x86/math-emu/poly.h
+++ b/arch/x86/math-emu/poly.h
@@ -39,7 +39,7 @@ asmlinkage void mul_Xsig_Xsig(Xsig *dest, const Xsig *mult);
asmlinkage void shr_Xsig(Xsig *, const int n);
asmlinkage int round_Xsig(Xsig *);
asmlinkage int norm_Xsig(Xsig *);
-asmlinkage void div_Xsig(Xsig *x1, const Xsig *x2, const Xsig *dest);
+asmlinkage void div_Xsig(Xsig *x1, const Xsig *x2, Xsig *dest);
/* Macro to extract the most significant 32 bits from a long long */
#define LL_MSW(x) (((unsigned long *)&x)[1])
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread* [tip: x86/build] x86/math-emu: Fix div_Xsig() prototype
2025-08-07 20:53 [PATCH] x86: math-emu: fix div_Xsig prototype Arnd Bergmann
@ 2025-11-09 23:04 ` tip-bot2 for Arnd Bergmann
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2025-11-09 23:04 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Arnd Bergmann, Borislav Petkov (AMD), x86, linux-kernel
The following commit has been merged into the x86/build branch of tip:
Commit-ID: 780813d7018067f2796f023b56b51385970be460
Gitweb: https://git.kernel.org/tip/780813d7018067f2796f023b56b51385970be460
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 07 Aug 2025 22:53:28 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Sun, 09 Nov 2025 21:01:08 +01:00
x86/math-emu: Fix div_Xsig() prototype
The third argument of div_Xsig() is the output of the division, but is marked
'const', which means the compiler is not expecting it to be updated and may
generate bad code around the call. clang-21 now warns about the pattern since
an uninitialized variable is passed into two 'const' arguments by reference:
arch/x86/math-emu/poly_atan.c:93:28: error: variable 'argSignif' is uninitialized \
when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
93 | div_Xsig(&Numer, &Denom, &argSignif);
| ^~~~~~~~~
arch/x86/math-emu/poly_l2.c:195:29: error: variable 'argSignif' is uninitialized \
when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
195 | div_Xsig(&Numer, &Denom, &argSignif);
| ^~~~~~~~~
The implementation is in assembly, so the problem has gone unnoticed since the
code was added in the linux-1.1 days. Remove the 'const' marker here.
Fixes: e19a1bdb835c ("Import 1.1.38")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20250807205334.123231-1-arnd@kernel.org
---
arch/x86/math-emu/poly.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/math-emu/poly.h b/arch/x86/math-emu/poly.h
index fc1c887..654bfe4 100644
--- a/arch/x86/math-emu/poly.h
+++ b/arch/x86/math-emu/poly.h
@@ -39,7 +39,7 @@ asmlinkage void mul_Xsig_Xsig(Xsig *dest, const Xsig *mult);
asmlinkage void shr_Xsig(Xsig *, const int n);
asmlinkage int round_Xsig(Xsig *);
asmlinkage int norm_Xsig(Xsig *);
-asmlinkage void div_Xsig(Xsig *x1, const Xsig *x2, const Xsig *dest);
+asmlinkage void div_Xsig(Xsig *x1, const Xsig *x2, Xsig *dest);
/* Macro to extract the most significant 32 bits from a long long */
#define LL_MSW(x) (((unsigned long *)&x)[1])
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-09 23:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-07 20:53 [PATCH] x86: math-emu: fix div_Xsig prototype Arnd Bergmann
2025-11-09 23:04 ` [tip: x86/build] x86/math-emu: Fix div_Xsig() prototype tip-bot2 for Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®