lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <163bc2f64b5a3dd7b96a12aaca6733b408ddc880.1692283195.git.geert@linux-m68k.org>
Date:   Thu, 17 Aug 2023 16:44:51 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     linux-m68k@...ts.linux-m68k.org
Cc:     Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
        Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH 4/6] m68k: math-emu: Replace external declarations by header inclusion

Replace the (incorrect) external declarations by an inclusion of the
appropriate header file.

Semantically, the "src" parameters of the various fp_*() functions are
constant.  However, they cannot actually be const as most of these
functions perform a normalization step first.  As the fp_one constant
passed to fp_add() is already normalized, it is safe to cast away its
constness when making the function call.

Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
---
 arch/m68k/math-emu/fp_log.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index a8eac8c81757d22e..2426634c4ba74377 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -15,6 +15,7 @@
 
 */
 
+#include "fp_arith.h"
 #include "fp_emu.h"
 
 static const struct fp_ext fp_one =
@@ -22,9 +23,6 @@ static const struct fp_ext fp_one =
 	.exp = 0x3fff,
 };
 
-extern struct fp_ext *fp_fadd(struct fp_ext *dest, const struct fp_ext *src);
-extern struct fp_ext *fp_fdiv(struct fp_ext *dest, const struct fp_ext *src);
-
 struct fp_ext *
 fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
 {
@@ -70,7 +68,8 @@ fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
 	 *	sqrt(x) = 1 + 1/2*(x-1)
 	 *		= 1/2*(1+x)
 	 */
-	fp_fadd(dest, &fp_one);
+	/* It is safe to cast away the constness, as fp_one is normalized */
+	fp_fadd(dest, (struct fp_ext *)&fp_one);
 	dest->exp--;		/* * 1/2 */
 
 	/*
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ