qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user/ppc: Narrow type of ccr in save_user_regs
@ 2022-04-01 19:16 Richard Henderson
  2022-04-01 21:44 ` Cédric Le Goater
  2022-04-04  6:52 ` Cédric Le Goater
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Henderson @ 2022-04-01 19:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: danielhb413, clg, david

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>
---
 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
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-04  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01 19:16 [PATCH] linux-user/ppc: Narrow type of ccr in save_user_regs Richard Henderson
2022-04-01 21:44 ` Cédric Le Goater
2022-04-04  6:52 ` Cédric Le Goater
2022-04-04  8:41   ` Peter Maydell
2022-04-04  9:09     ` Cédric Le Goater
2022-04-04  9:25       ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).