Skip to contentSkip to conversation

m68k: fix floatx80_mod() (Coverity CID1390568)

PATCH In review Laurent Vivier 2 participants 2 messages May 8, 2018 – May 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k: fix floatx80_mod() (Coverity CID1390568)

Update the variable checked by the loop condition (expDiff). Backport the update from Previous.

Fixes 591596b77a ("target/m68k: add fmod/frem")
---
 target/m68k/softfloat.c | 1 +
 1 file changed, 1 insertion(+)
target/m68k/softfloat.c +1 -0
index e41b07d042..d093997219 100644
@@ -103,6 +103,7 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status)
         mul64To128(bSig, qTemp, &term0, &term1);
         sub128(aSig0, aSig1, term0, term1, &aSig0, &aSig1);
         shortShift128Left(aSig0, aSig1, 62, &aSig0, &aSig1);
+        expDiff -= 62;
     }
     expDiff += 64;
     if (0 < expDiff) {
Signature · 1 line
2.14.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Laurent Vivier

Update the variable checked by the loop condition (expDiff). Backport the update from Previous.

Fixes 591596b77a ("target/m68k: add fmod/frem")
---
 target/m68k/softfloat.c | 1 +
 1 file changed, 1 insertion(+)
target/m68k/softfloat.c +0 -0
index e41b07d042..d093997219 100644

target/m68k/softfloat.c floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status) · line 109

Quoted 7 lines
target/m68k/softfloat.c +1 -0
@@ -103,6 +103,7 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status)
         mul64To128(bSig, qTemp, &term0, &term1);
         sub128(aSig0, aSig1, term0, term1, &aSig0, &aSig1);
         shortShift128Left(aSig0, aSig1, 62, &aSig0, &aSig1);
+        expDiff -= 62;
     }
     expDiff += 64;
     if (0 < expDiff) {