From patchwork Mon Jul 29 11:00:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18627 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9FE0A248E5 for ; Mon, 29 Jul 2013 11:00:37 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id i72sf4294861yha.4 for ; Mon, 29 Jul 2013 04:00:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=Fz1+jZPK26ZQVye1Hjz0oV94HOz8zxjtATx+cUp6q4k=; b=Pdb8TaYStrZ6gqOsGtAp9H3/d8pRGVnkprRvN1MsZZ3RQvuKvXxX5ZYmKf7gPXbeXE ZrMUlPJG9ca8lKJCx021JDkhWsg+1dB3fbWsv1/KtfbGqXGkoEMJjAH9nSjlFZDXe/lN CY7zeyw0oyt2M58iKBAgcQ0nvwxOJGCPWXF7243QuaLrg8Q5lwE3ZtWQLSJQbeKL1bFV CcLbB9NRS1sZ12ECcuH+QaMgF+3rwWD0fHRLU3PajmRGiDOh/kuaQT+7aBqmBcq+MPnn vVmWHERLTsmFMEnwa2Vtq7/TSkzCa6YhQBJTf3tOYBuqz+Ry5Ga16/sZcy58rZAREzRG 1Rbw== X-Received: by 10.236.119.227 with SMTP id n63mr31036060yhh.38.1375095637296; Mon, 29 Jul 2013 04:00:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.110.195 with SMTP id ic3ls441055qeb.62.gmail; Mon, 29 Jul 2013 04:00:37 -0700 (PDT) X-Received: by 10.58.172.39 with SMTP id az7mr25220918vec.13.1375095637191; Mon, 29 Jul 2013 04:00:37 -0700 (PDT) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) by mx.google.com with ESMTPS id ix2si3201836vdb.20.2013.07.29.04.00.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 29 Jul 2013 04:00:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.43; Received: by mail-vb0-f43.google.com with SMTP id h11so1784072vbh.16 for ; Mon, 29 Jul 2013 04:00:37 -0700 (PDT) X-Received: by 10.58.211.227 with SMTP id nf3mr25777562vec.20.1375095637115; Mon, 29 Jul 2013 04:00:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp109803vcb; Mon, 29 Jul 2013 04:00:36 -0700 (PDT) X-Received: by 10.205.116.137 with SMTP id fi9mr8414759bkc.149.1375095634649; Mon, 29 Jul 2013 04:00:34 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id py9si7862869bkb.283.2013.07.29.04.00.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 29 Jul 2013 04:00:34 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1V3lBo-0003a4-A1; Mon, 29 Jul 2013 12:00:32 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Alexander Graf , qemu-ppc@nongnu.org, Anthony Liguori Subject: [PATCH for-1.6 1/2] linux-user/signal.c: PPC: Silence clang uninitialized-use warning Date: Mon, 29 Jul 2013 12:00:31 +0100 Message-Id: <1375095632-13735-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375095632-13735-1-git-send-email-peter.maydell@linaro.org> References: <1375095632-13735-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQneQbM2JnJLspqvvnTzraNMZJoVBeSKnTOmtoVbzL+5bBSc4UHWdnkEUJxuLaqG2uu9UY+1 X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- linux-user/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index a5e8906..d63777d 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -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;