From patchwork Wed Apr 17 07:21:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10904719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 964AA14DB for ; Wed, 17 Apr 2019 07:22:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BBC42874C for ; Wed, 17 Apr 2019 07:22:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6060328A6F; Wed, 17 Apr 2019 07:22:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F03FA287F9 for ; Wed, 17 Apr 2019 07:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=gwolNrFprFnoFWIPepqEUWnn4uDzdUBSaBft+WBPB5k=; b=RADXhtc67RMmwM S60WdJtok3+/JKzHxM03C6U8naOc2GPSkjXjTo8sMdLSe0e1JPEhYaY+jJmFaWikRkJQbSZ5I97wJ LH+wqtcNKDL6LUmFkw9LCZ9R+NuXX3q9D4djqR9H0fgNg3XHsXPnFQyh1sw3s+L7cVUGmiGBkGLqf QFpe5LKSHpWimUEhI4VnNtFPPrtYAoO2H3r0z3s34q14nvFX80QZjUc5e5LPbVdg7zOMva+Gy5vtO yck+6hFwbFS7MUrJ2F7v6BrxTbU6wUxyh1OfrytRNAlKTCa8HMpgCgyq1/GPUX32HcGuMa9j9Evxd zj//KZIrgNEv8om7E3xg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGetY-0002eG-TN; Wed, 17 Apr 2019 07:22:12 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGetV-0002cl-QJ for linux-arm-kernel@lists.infradead.org; Wed, 17 Apr 2019 07:22:11 +0000 Received: by mail-ed1-x543.google.com with SMTP id d55so19273157ede.0 for ; Wed, 17 Apr 2019 00:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3v8wsDy/ILxximCAVSroNW2xK66Zhy7QhWurePfHt2c=; b=P7obGYnGhTlp1nP9s4sVV1v7uo1BZAlPWNRKoB+iGUvBJg59OVXXnfYNoIvDN/l5rb Lj+zBUEnftZreUYfToqqzu/DYQnXmYpgGYjXUUG+tbLutDCaxjwrVx2gF8B0Tzlb2lhV 7fPHLwG5Ff0XegisJWkrXmMiM3ejupkgRl1DpYc7RZ9p82ohKf0b1WnugCbUn75sjek+ qEqtOdAZvIn6jeuvfai0GCFrLSiP3Hatml5cMThv5xFWew4Y9Rn8arnvgj/sT3UvffnM ZI3ttiTiRuzIhDsp0kofwDKpVfOu9/ppj8XXXFhUr7u7lDp714OuJHSSkkRO6fSwZRts qM+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3v8wsDy/ILxximCAVSroNW2xK66Zhy7QhWurePfHt2c=; b=hrXZm2Vy3fVZ0LfPg+5i4SHpMqlxVbhPw9gVJbNiaV4/KCgKbARjHJ/UkxqJ+ihlFP 1RmsCXRd8NOjFjJukqbC4XrdyjzXKMoHSmObIR+tZAVbpRm5zp+M5YCbkQa2SeeTL25B EOr14kCDythKzHDvrB9dWyznMJvVDywFk9kQHIkE/2jmPLoqhsqPRusP6u7xDMWyUkpb gYWONezfgV0oOWeaeYvqn7B37qMPTLo6w8XzYm2ZCkVJUtypJ7bwi/b8PzBYsUW0ccSS hy/8musRXgG8iAk0AUbWgRhjnJhkRNUrgLQw6OJgU6ZFNDAQhd5V9vLF8bzNueKxXQcc 11Tg== X-Gm-Message-State: APjAAAW9wm+eYtGlXyCTa8KcV31fIvhBrxzTKvxQkLDv+9GUZGjDyQBd aovg4x7vnZkXb7UNkQjferg0opsIgl8= X-Google-Smtp-Source: APXvYqxc0WZjk8xaXLbNAFK+ANxUnCzD9KngaYeQE14wOtXlaED2g9GpBy2QqIW2ZYnA01FpFiAu0Q== X-Received: by 2002:a17:906:90d3:: with SMTP id v19mr15384841ejw.268.1555485726589; Wed, 17 Apr 2019 00:22:06 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:2b:2b84::2]) by smtp.gmail.com with ESMTPSA id s3sm8439889eds.0.2019.04.17.00.22.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 00:22:04 -0700 (PDT) From: Nathan Chancellor To: Catalin Marinas , Will Deacon Subject: [PATCH] arm64: futex: Restore oldval initialization to work around buggy compilers Date: Wed, 17 Apr 2019 00:21:21 -0700 Message-Id: <20190417072121.4450-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190417_002209_874230_8D73A9E7 X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , Nathan Chancellor , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 045afc24124d ("arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value") removed oldval's zero initialization in arch_futex_atomic_op_inuser because it is not necessary. Unfortunately, Android's arm64 GCC 4.9.4 [1] does not agree: ../kernel/futex.c: In function 'do_futex': ../kernel/futex.c:1658:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized] return oldval == cmparg; ^ In file included from ../kernel/futex.c:73:0: ../arch/arm64/include/asm/futex.h:53:6: note: 'oldval' was declared here int oldval, ret, tmp; ^ GCC fails to follow that when ret is non-zero, futex_atomic_op_inuser returns right away, avoiding the uninitialized use that it claims. Restoring the zero initialization works around this issue. [1]: https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/ Cc: stable@vger.kernel.org Fixes: 045afc24124d ("arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value") Signed-off-by: Nathan Chancellor Reviewed-by: Greg Kroah-Hartman --- arch/arm64/include/asm/futex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h index e1d95f08f8e1..c7e1a7837706 100644 --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h @@ -50,7 +50,7 @@ do { \ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr) { - int oldval, ret, tmp; + int oldval = 0, ret, tmp; u32 __user *uaddr = __uaccess_mask_ptr(_uaddr); pagefault_disable();