]> git.proxmox.com Git - qemu.git/commitdiff
linux-user/signal.c: PPC: Silence clang uninitialized-use warning
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 29 Jul 2013 11:00:31 +0000 (12:00 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 30 Jul 2013 00:56:52 +0000 (19:56 -0500)
Silence a clang warning in a PPC signal return function:

/home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/signal.c:4611:9: error: variable 'sr_addr' is used
      uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (!lock_user_struct(VERIFY_READ, sc, sc_addr, 1))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/signal.c:4636:28: note: uninitialized use occurs here
    unlock_user_struct(sr, sr_addr, 1);
                           ^~~~~~~
/home/petmay01/linaro/qemu-from-laptop/qemu/linux-user/qemu.h:442:27: note: expanded from macro 'unlock_user_struct'
    unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
                          ^

This happens when we unlock a user struct which we never
attempted to lock. Strictly, clang is actually wrong here -- it
hasn't been able to spot that unlock_user_struct() doesn't use
its second argument if the first is NULL. However it doesn't
seem too unreasonable to demand that we pass in initialized
values to it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1375095632-13735-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
linux-user/signal.c

index a5e8906c4d8a78d856104fb0350442a024ffc673..d63777d4de1235f8b3510adbae64194bbb6ca072 100644 (file)
@@ -4603,7 +4603,7 @@ long do_sigreturn(CPUPPCState *env)
 {
     struct target_sigcontext *sc = NULL;
     struct target_mcontext *sr = NULL;
-    target_ulong sr_addr, sc_addr;
+    target_ulong sr_addr = 0, sc_addr;
     sigset_t blocked;
     target_sigset_t set;