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: <1289707863-1768-2-git-send-email-shan.hai@windriver.com>
Date:	Sun, 14 Nov 2010 12:11:03 +0800
From:	Hai Shan <haishan.bai@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Hai Shan <shan.hai@...driver.com>
Subject: [PATCH] Fix float to unsigned conversion failure with SPE enabled

Fixed the failure on converting minus float to unsigned int with SPE enabled

Signed-off-by: Hai Shan <shan.hai@...driver.com>
---
 arch/powerpc/math-emu/math_efp.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/math-emu/math_efp.c b/arch/powerpc/math-emu/math_efp.c
index 41f4ef3..338a128 100644
--- a/arch/powerpc/math-emu/math_efp.c
+++ b/arch/powerpc/math-emu/math_efp.c
@@ -320,7 +320,9 @@ int do_spe_mathemu(struct pt_regs *regs)
 			} else {
 				_FP_ROUND_ZERO(1, SB);
 			}
-			FP_TO_INT_S(vc.wp[1], SB, 32, ((func & 0x3) != 0));
+			/* SB_s: convert from minus float to unsigned int */
+			FP_TO_INT_S(vc.wp[1], SB, 32, 
+					((func & 0x3) != 0) || SB_s);
 			goto update_regs;
 
 		default:
@@ -458,7 +460,11 @@ cmp_s:
 			} else {
 				_FP_ROUND_ZERO(2, DB);
 			}
-			FP_TO_INT_D(vc.wp[1], DB, 32, ((func & 0x3) != 0));
+			/* DB_s: convert from minus long double to 
+			 * unsigned long long
+			 */
+			FP_TO_INT_D(vc.wp[1], DB, 32, 
+					((func & 0x3) != 0) || DB_s);
 			goto update_regs;
 
 		default:
@@ -589,8 +595,11 @@ cmp_d:
 				_FP_ROUND_ZERO(1, SB0);
 				_FP_ROUND_ZERO(1, SB1);
 			}
-			FP_TO_INT_S(vc.wp[0], SB0, 32, ((func & 0x3) != 0));
-			FP_TO_INT_S(vc.wp[1], SB1, 32, ((func & 0x3) != 0));
+			/* SB*_s: convert from minus float to unsigned int */
+			FP_TO_INT_S(vc.wp[0], SB0, 32, 
+					((func & 0x3) != 0) || SB0_s);
+			FP_TO_INT_S(vc.wp[1], SB1, 32, 
+					((func & 0x3) != 0) || SB1_s);
 			goto update_regs;
 
 		default:
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ