Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3384106ybp; Sun, 6 Oct 2019 10:44:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgm6JWG+FqMECo+7+e8mXJCuRbHZ/Vn9/aVSIHuRhxH2EfXEKywVjI5kvy2X68QD1Y6wOS X-Received: by 2002:a17:907:211c:: with SMTP id qn28mr20814678ejb.244.1570383880412; Sun, 06 Oct 2019 10:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570383880; cv=none; d=google.com; s=arc-20160816; b=XEH70h8cSHByXSZH599s3Ke/4AdATQtWp2Xf6zCT7Z4K99Sh54B9w3z8XFsTs9YoRu VeCSjQQBSUgMfFRL7QK0hfOWnqKN/ADA1oNUNoUNLINUCNMw55T4C7a2nduqjtfUhCb2 mffObNb8Fz65aqgN+rV2KXpjxMOsBKSzQCEg+nNObSRBekMX+ivgxcTpycaMM/WF68O+ oTRg6tBTwEil8qMCvOlXciKQvsLLY9gNUOj+Iuox4kXJ84bp9jJDbYZ2SnjJFfhy7Kw9 0mYCIOjvKQlzB1kbFvxzsC5Uc/vrLqxu86yLsS297gW/ZLIs0wi1vLR7XruNW9V3i4Ud TO4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fKGCgPVNxcOCdEtUu0iXBC1VUTnyqMu9GMYPzJg6ugk=; b=F2YWO+U2TOJex7p6pW7Jk4RPCoElb377IeqDovADHpN9za2I2UuQUJ/GWUOVWSxwN8 +USVj0ttL9KhdkIikP18Aras64b6huiFAedsZ/Dk1xp//KA+3ifmnXh3GzHbfIh73poz uibhIg3ym+DDvQWIWofOGnbBoG2Davr91xuHrmMKRlZN7mxiXoy0mgZb6sWpuv8sdWIr o7VFoaDnyyU8e2CFWkEquG4CJa5JeZDbjDiQ3iyjmBVqOQNumdI4z1VFBwC3m5nFdUut Pjx9Az8QhOmIFEiBjipGEwb2WfmvIUWl8mAEhRWjVmpVxrfjN9annrSx2ZVmzdtNem4l arwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nhqYum3k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o49si7232184edc.261.2019.10.06.10.44.16; Sun, 06 Oct 2019 10:44:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nhqYum3k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730731AbfJFRmo (ORCPT + 99 others); Sun, 6 Oct 2019 13:42:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:42594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730392AbfJFRmn (ORCPT ); Sun, 6 Oct 2019 13:42:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 347AB2133F; Sun, 6 Oct 2019 17:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383762; bh=I8B5kB4woAS8zeIX3RW9KSgJ4z9Xq/XpjsL8Ffdl0vQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nhqYum3kTr/i5LqWzaAxBR4sWgSTPxAtMNjW1Bn2AkoVMxctqKJTbema5Age0GF3P dfEKqxtowqJc0qrLntNT5dKnNcRhvqttktboM4dYgrkGJ8r+V0yqDjuEASch93BM6r 9RsPEgV9Ugqc3L+IY+GjjzdDfosyZyGn7jBNWHn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.3 042/166] powerpc/futex: Fix warning: oldval may be used uninitialized in this function Date: Sun, 6 Oct 2019 19:20:08 +0200 Message-Id: <20191006171216.487058904@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171212.850660298@linuxfoundation.org> References: <20191006171212.850660298@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy [ Upstream commit 38a0d0cdb46d3f91534e5b9839ec2d67be14c59d ] We see warnings such as: kernel/futex.c: In function 'do_futex': kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized] return oldval == cmparg; ^ kernel/futex.c:1651:6: note: 'oldval' was declared here int oldval, ret; ^ This is because arch_futex_atomic_op_inuser() only sets *oval if ret is 0 and GCC doesn't see that it will only use it when ret is 0. Anyway, the non-zero ret path is an error path that won't suffer from setting *oval, and as *oval is a local var in futex_atomic_op_inuser() it will have no impact. Signed-off-by: Christophe Leroy [mpe: reword change log slightly] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/86b72f0c134367b214910b27b9a6dd3321af93bb.1565774657.git.christophe.leroy@c-s.fr Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/futex.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h index 3a6aa57b9d901..eea28ca679dbb 100644 --- a/arch/powerpc/include/asm/futex.h +++ b/arch/powerpc/include/asm/futex.h @@ -60,8 +60,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, pagefault_enable(); - if (!ret) - *oval = oldval; + *oval = oldval; prevent_write_to_user(uaddr, sizeof(*uaddr)); return ret; -- 2.20.1