From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A0C8C10F11 for ; Wed, 24 Apr 2019 17:25:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3DE021907 for ; Wed, 24 Apr 2019 17:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556126717; bh=ZMiG4vDIQPjGtMFqgJMXGJGkYyTVFBSQ+FrT2bz0img=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ez61Sow4hWRDYYOHG++4OzrT+JBiarFv8Sz1xY0iHrmDqDgUhuFGwqm9/fAbS2tds k0UX+GWwHQLhXBZo3vBNk6QfbOuHVACKmKvrL9HdfSD8xjLMpDpsMawUgKDmrifjDC hvqxP5e2oPgtJQhImzPkoe4nOVWDYxma8+6EX3wA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390000AbfDXRZQ (ORCPT ); Wed, 24 Apr 2019 13:25:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:50966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389973AbfDXRZG (ORCPT ); Wed, 24 Apr 2019 13:25:06 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (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 62CFD205ED; Wed, 24 Apr 2019 17:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556126706; bh=ZMiG4vDIQPjGtMFqgJMXGJGkYyTVFBSQ+FrT2bz0img=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MnmIA1J6tQNhmgNPj9vGbOycP8tMJB2OPUZws5Jzvxlz4kKF1gPYESPZdD49TWCPd 3Afg+v2JdbqcdZGga/lrkl4dEHOMdXkBYg+gALEuY4lfFioL0mrl1xQW1E4A/BLlHX 8oEzNmXsaG2Lct59FMHYS/iwEixiZI6r1TLqSWMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Catalin Marinas Subject: [PATCH 4.9 31/44] arm64: futex: Restore oldval initialization to work around buggy compilers Date: Wed, 24 Apr 2019 19:10:09 +0200 Message-Id: <20190424170859.138357280@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170839.924291114@linuxfoundation.org> References: <20190424170839.924291114@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: Nathan Chancellor commit ff8acf929014b7f87315588e0daf8597c8aa9d1c upstream. 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") Reviewed-by: Greg Kroah-Hartman Signed-off-by: Nathan Chancellor Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/futex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h @@ -53,7 +53,7 @@ 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; pagefault_disable();