diff mbox series

target/ppc: Fix test the decrementer exception

Message ID 20211004212027.432553-1-clg@kaod.org (mailing list archive)
State New, archived
Headers show
Series target/ppc: Fix test the decrementer exception | expand

Commit Message

Cédric Le Goater Oct. 4, 2021, 9:20 p.m. UTC
Commit 4d9b8ef9b5ab ("target/ppc: Fix 64-bit decrementer") introduced
new int64t variables and broke the test triggering the decrementer
exception. Revert partially the change to evaluate both clause of the
if statement.

Fixes: Coverity CID 1464061
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/ppc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

BALATON Zoltan Oct. 4, 2021, 9:45 p.m. UTC | #1
On Mon, 4 Oct 2021, Cédric Le Goater wrote:
> Commit 4d9b8ef9b5ab ("target/ppc: Fix 64-bit decrementer") introduced
> new int64t variables and broke the test triggering the decrementer
> exception. Revert partially the change to evaluate both clause of the
> if statement.
>
> Fixes: Coverity CID 1464061

Shouldn't this be:

Reported-by: Coverity CID 1464061
Fixes: 4d9b8ef9b5ab ("target/ppc: Fix 64-bit decrementer")

or something similar?

Regards,
BALATON Zoltan

> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> hw/ppc/ppc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index f5d012f860af..a724b0bb5ecb 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -848,7 +848,7 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t *nextp,
>      * On MSB edge based DEC implementations the MSB going from 0 -> 1 triggers
>      * an edge interrupt, so raise it here too.
>      */
> -    if ((signed_value < 3) ||
> +    if ((value < 3) ||
>         ((tb_env->flags & PPC_DECR_UNDERFLOW_LEVEL) && signed_value < 0) ||
>         ((tb_env->flags & PPC_DECR_UNDERFLOW_TRIGGERED) && signed_value < 0
>           && signed_decr >= 0)) {
>
Cédric Le Goater Oct. 5, 2021, 5:26 a.m. UTC | #2
in Subject: s/test//

On 10/4/21 23:45, BALATON Zoltan wrote:
> On Mon, 4 Oct 2021, Cédric Le Goater wrote:
>> Commit 4d9b8ef9b5ab ("target/ppc: Fix 64-bit decrementer") introduced
>> new int64t variables and broke the test triggering the decrementer
>> exception. Revert partially the change to evaluate both clause of the
>> if statement.
>>
>> Fixes: Coverity CID 1464061
> 
> Shouldn't this be:
> 
> Reported-by: Coverity CID 1464061
> Fixes: 4d9b8ef9b5ab ("target/ppc: Fix 64-bit decrementer")
> 
> or something similar?

I went through the commit logs before sending and that seemed to be
the latest practice.

Not an issue. I can resend.

C.

> 
> Regards,
> BALATON Zoltan
> 
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>> hw/ppc/ppc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
>> index f5d012f860af..a724b0bb5ecb 100644
>> --- a/hw/ppc/ppc.c
>> +++ b/hw/ppc/ppc.c
>> @@ -848,7 +848,7 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t *nextp,
>>      * On MSB edge based DEC implementations the MSB going from 0 -> 1 triggers
>>      * an edge interrupt, so raise it here too.
>>      */
>> -    if ((signed_value < 3) ||
>> +    if ((value < 3) ||
>>         ((tb_env->flags & PPC_DECR_UNDERFLOW_LEVEL) && signed_value < 0) ||
>>         ((tb_env->flags & PPC_DECR_UNDERFLOW_TRIGGERED) && signed_value < 0
>>           && signed_decr >= 0)) {
>>
diff mbox series

Patch

diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index f5d012f860af..a724b0bb5ecb 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -848,7 +848,7 @@  static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t *nextp,
      * On MSB edge based DEC implementations the MSB going from 0 -> 1 triggers
      * an edge interrupt, so raise it here too.
      */
-    if ((signed_value < 3) ||
+    if ((value < 3) ||
         ((tb_env->flags & PPC_DECR_UNDERFLOW_LEVEL) && signed_value < 0) ||
         ((tb_env->flags & PPC_DECR_UNDERFLOW_TRIGGERED) && signed_value < 0
           && signed_decr >= 0)) {