Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3629277pxb; Mon, 24 Jan 2022 13:55:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJydnpzQKYw73CLUWcP+27Pp4jTWmQBaw/DD3deeJZ2MCR4rlZbrvqPEXsDPyhzZlwla4MOG X-Received: by 2002:a05:6a00:1512:b0:4c0:efb0:1152 with SMTP id q18-20020a056a00151200b004c0efb01152mr16018849pfu.47.1643061335604; Mon, 24 Jan 2022 13:55:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061335; cv=none; d=google.com; s=arc-20160816; b=ClSW37d1KY4a3IorjJqZU7X4QvnHumKBlwzkX5EB2fWrg+v6X5uXeF+vwZUiXZkmma 1gxZXiUOLq4pQK254pqzD5p9dOOg/2NYRYMwSqyDt9GgSu1vOHlo3TGJROuB8EtomPp+ RoVT2obvBgmtXTi3qKerVGaJYvXyEpqcTr5OKnAiLmGb4sBjtKOvXLUYlVWvkQCkGbHP aY01nm98sgcEuICRcZSB6qLha9LdQe6ixOEd2OQI4NWWVcqFHUnqbwxxzHsbTnvPeBr1 6o0WBeNYzLBxxPHoSeVHXCdlJyzjFWW7kEPuy5PukD+tivOHSu6N8e0R926L4lPl/3oh Sl0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yZ7DtT8MBnPySwp1AY4hyKEkDbmCeTUBLWA3xBWZonA=; b=AzNSYshMsqyCNmQsrx6do6/IJ9VkGwYo7pLgrYQh969/n8WfTv+1mESz+0Ikbh4miH kCXSkV88IxyhvCkL0U0KvH9R4m/Mr9QHsWv2aTRtknn4u0mSPn0PE9pgcvDJkWc9nBTN U4wP1D+p4tIJbLEizombARItSp5DlbPAXm5oG4itBz15ftYkMNn6JiYUH9zLKtr7c+FE xe9G2/bJJFk0ctuHNtea+iHBx3iEs7BKa/LMKy7Ahlu0ymLY57tUVW6wYKC6se03eKgb oA0X6oOAkZo8kSNg7T/2jpNcSXgrfQeOvnTvLvWvhX1ZbwI0UBo1V5v7onsxXrg30S99 Bqrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bwysiofR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si428902pjq.31.2022.01.24.13.55.22; Mon, 24 Jan 2022 13:55:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bwysiofR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378976AbiAXVoH (ORCPT + 99 others); Mon, 24 Jan 2022 16:44:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58514 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446333AbiAXVH4 (ORCPT ); Mon, 24 Jan 2022 16:07:56 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA35461320; Mon, 24 Jan 2022 21:07:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E59FC340E5; Mon, 24 Jan 2022 21:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058473; bh=mogSOkaOkrrWOdetxmlOv7cZA4WGTZhATUoGO5ISBOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bwysiofRA47rJrF6DC7TYnewxQIEkx2vb020Fmsv7+Nwvk5Q5ohbYraL+0WvW1h6h 8FHc2Lmxrvtyhco6NYYKu+kJ0pZf7XFMmA6XxPQvjjg9OnA8IgV8m+tza0UgPDvizq 6oHVEMiAFpK+IW3X6rd+tWfjPdY3Xm37qNvTB3ZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Dave Hansen , Borislav Petkov , Sasha Levin Subject: [PATCH 5.16 0267/1039] x86/uaccess: Move variable into switch case statement Date: Mon, 24 Jan 2022 19:34:16 +0100 Message-Id: <20220124184134.279284920@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook [ Upstream commit 61646ca83d3889696f2772edaff122dd96a2935e ] When building with automatic stack variable initialization, GCC 12 complains about variables defined outside of switch case statements. Move the variable into the case that uses it, which silences the warning: ./arch/x86/include/asm/uaccess.h:317:23: warning: statement will never be executed [-Wswitch-unreachable] 317 | unsigned char x_u8__; \ | ^~~~~~ Fixes: 865c50e1d279 ("x86/uaccess: utilize CONFIG_CC_HAS_ASM_GOTO_OUTPUT") Signed-off-by: Kees Cook Signed-off-by: Dave Hansen Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20211209043456.1377875-1-keescook@chromium.org Signed-off-by: Sasha Levin --- arch/x86/include/asm/uaccess.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 33a68407def3f..8ab9e79abb2b4 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -314,11 +314,12 @@ do { \ do { \ __chk_user_ptr(ptr); \ switch (size) { \ - unsigned char x_u8__; \ - case 1: \ + case 1: { \ + unsigned char x_u8__; \ __get_user_asm(x_u8__, ptr, "b", "=q", label); \ (x) = x_u8__; \ break; \ + } \ case 2: \ __get_user_asm(x, ptr, "w", "=r", label); \ break; \ -- 2.34.1