Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp839961yba; Wed, 24 Apr 2019 10:26:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0AxvRCpirH4DN2GX2hWwLxBaAIq0rwsDc3di+GSMjoAJKkYrF7euwF3eZclcw37jjwO0u X-Received: by 2002:a63:c104:: with SMTP id w4mr31435677pgf.409.1556126765863; Wed, 24 Apr 2019 10:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556126765; cv=none; d=google.com; s=arc-20160816; b=BlO8vTJF8zpIKeR5ZFZo8Ll7ZFuYvon2IBsOosb476haPvnNEHJB5jMgmtZrg9H0xS o+RvZGy+jFkMKz1MTRa+8xxkL6aP+eOMuBei525GIZtv6UFcR3KOe47V3FiVbVM1yvyT 8mVF0lrOjxVc/ebUHlKZI3r0U44j2xkbhtr8bArVnDzZThu5ONPpABVDhAPJsOjjV/TX PYZ/99627Pn2gNzFj7jbT79SgfpGYnR79vxjgVLT3+gKoXmXnWOPaZJbbEz3dJgUSTAh tb+LngUTgAfHLnLqci9GgXqupUrTw5XKneePBH/6EsSwtI7nrdBt9GN8FwOYfMyOlH5C jX5A== 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=jNT7bjPFbeIX/eU/m6hlaAHxbVK7tgjvogMX15Uavec=; b=UBbHuDtxpfikspHqaTUVgsvqEsSO1Tiy1fetqsXIzkPGAqfYTdzQuN07EImeoaaFiK CNy3abbiFLxGU3Gw2gStCGiCb91tcGNsbn/k4UzNZFrnSEoutp88n5h1rhzQpwgYQnWz pHJijzIETr0rydZ64hSb5Qt2wOP94EWJGL8QzxIa5aiAb/gE1Dds29F0VsDSHJrvX7La rfULfWvEK0eJbeL//RGU+pEtTfSliwD9NBNY/IJVkG3+Y/EzGAS9z1ePr0QJJMyIoabU LB57JKp72WxwMWteRy+tEkF2bsM4Q5tZhwkGAPvdee167YLqdIDWhrSpG2z/A5DTzKK6 nM9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VxMN3Yku; 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 m3si19731703plb.245.2019.04.24.10.25.51; Wed, 24 Apr 2019 10:26:05 -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=VxMN3Yku; 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 S2389644AbfDXRXE (ORCPT + 99 others); Wed, 24 Apr 2019 13:23:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:48680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389251AbfDXRXD (ORCPT ); Wed, 24 Apr 2019 13:23:03 -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 3EE9220675; Wed, 24 Apr 2019 17:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556126582; bh=kq33SpP71H8pGLorVT3EbrhHtFjqjupFg4RONrTaoAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VxMN3Ykuv86J+ezab9rczrU97gOoGb3u4N3SiBvNYiyafvOhlXgCG62lCbLvxziyb JbIAQvCTE4bnSF9jdkguM0L6ZnRW7x8tSgPEXFj18DIh9dgkDEn60TLqf8pFPkH0Dg lisWQkOcCqTqWbyVaIIlv3mwtRc8GQM87Gy1az6U= 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.4 159/168] arm64: futex: Restore oldval initialization to work around buggy compilers Date: Wed, 24 Apr 2019 19:10:03 +0200 Message-Id: <20190424170932.533238683@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170923.452349382@linuxfoundation.org> References: <20190424170923.452349382@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 @@ -55,7 +55,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();