powerpc/lib: Fix emulate_step() std test
authorNicholas Piggin <npiggin@gmail.com>
Wed, 26 Feb 2020 05:53:02 +0000 (15:53 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 17 Mar 2020 13:05:54 +0000 (00:05 +1100)
We should be checking that the instruction was stepped *and* that the
target register has the right value.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
[mpe: Write change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200226055302.1577954-1-npiggin@gmail.com
arch/powerpc/lib/test_emulate_step.c

index 42347067739ca374c80833146f6e5c6c3ed5e951..00d70253cb5bfe05a068b37dff09377dc8b61b00 100644 (file)
@@ -160,7 +160,7 @@ static void __init test_std(void)
 
        /* std r5, 0(r3) */
        stepped = emulate_step(&regs, TEST_STD(5, 3, 0));
-       if (stepped == 1 || regs.gpr[5] == a)
+       if (stepped == 1 && regs.gpr[5] == a)
                show_result("std", "PASS");
        else
                show_result("std", "FAIL");