qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] linux-user/ppc: Narrow type of ccr in save_user_regs


From: Cédric Le Goater
Subject: Re: [PATCH] linux-user/ppc: Narrow type of ccr in save_user_regs
Date: Fri, 1 Apr 2022 23:44:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

On 4/1/22 21:16, Richard Henderson wrote:
Coverity warns that we shift a 32-bit value by N, and then
accumulate it into a 64-bit type (target_ulong on ppc64).

The ccr is always 8 * 4-bit fields, and thus is always a
32-bit quantity; narrow the type to avoid the warning.

Fixes: Coverity CID 1487223
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


---
  linux-user/ppc/signal.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c
index ec0b9c0df3..ce5a4682cd 100644
--- a/linux-user/ppc/signal.c
+++ b/linux-user/ppc/signal.c
@@ -229,7 +229,7 @@ static void save_user_regs(CPUPPCState *env, struct 
target_mcontext *frame)
  {
      target_ulong msr = env->msr;
      int i;
-    target_ulong ccr = 0;
+    uint32_t ccr = 0;
/* In general, the kernel attempts to be intelligent about what it
         needs to save for Altivec/FP/SPE registers.  We don't care that




reply via email to

[Prev in Thread] Current Thread [Next in Thread]