linux-user: Fix uninitialized variables
cover linux-user: Fix uninitialized variables
Fix a couple of uses of uninitialized variables in linux-user; both spotted by clang as compile warnings.
Peter Maydell (2):
linux-user/signal.c: Correct error path for AArch64 do_rt_sigreturn
linux-user: Don't return uninitialized value for atomic_barrier
syscall
linux-user/signal.c | 2 +- linux-user/syscall.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.0
PATCH 1/2 linux-user/signal.c: Correct error path for AArch64 do_rt_sigreturn
The error path in AArch64 do_rt_sigreturn() which fails before attempting lock_user_struct() was doing an unlock_user_struct() on an uninitialized variable. Initialize frame to NULL so we can use the same error-exit path in all cases (unlock of NULL is permitted and does nothing).
--- linux-user/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/signal.c +1 -1
@@ -1334,7 +1334,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,long do_rt_sigreturn (CPUARMState *env) { -struct target_rt_sigframe *frame; +struct target_rt_sigframe *frame =NULL ;abi_ulong frame_addr = env->xregs[31 ];if (frame_addr &15 ) {
Signature · 1 line
1.9.0
PATCH 2/2 linux-user: Don't return uninitialized value for atomic_barrier syscall
In reply to Peter MaydellQEMU's implementation of the m68k atomic_barrier syscall, like the kernel's, is just a no-op. However we still need to return a result code from it.
--- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
@@ -9142,6 +9142,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,case TARGET_NR_atomic_barrier: {/* Like the kernel implementation and the qemu arm barrier, no-op this? */ + ret =0 ;break ; }#endif
Signature · 1 line
1.9.0