Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3976954pxb; Tue, 25 Jan 2022 00:27:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfgvulEPGTbqkvlU34uemI8+3ZbaeTjvnFqwsqCi5Pws7tbqObfU9o3fi4D+cYfhWau29T X-Received: by 2002:a17:907:1694:: with SMTP id hc20mr6403715ejc.657.1643099265723; Tue, 25 Jan 2022 00:27:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099265; cv=none; d=google.com; s=arc-20160816; b=QCkTaoMKi1cfWsRUmD8svVkhXwQBgfB0+RD6GL1sEEJGigTXX0yJm6SW9ocEOgl7HU Ey9Fnn2QrJHF/SRJvy84fwPTH9w1ioCS8FNR/Hip5R34R2bdL24BG/m/p51dqtRx5vgR me8zv48+wU5ceeucFEiVsTJ8doBhxWZCC2rtTvb6CX03OUiMZbsXalZgyaznnUh7Fc3d MC6m2ZUpAJHzshKvZoX8prNNVHR5+JiLvuLpEvbzDjilCipZLriquYVxuhKSBuNSfOak eV0hSnRUDsB02haW/UrSdItNPE9bEJ0JGrtca4zhq7H83s5IitydRGTfkxkccsmP0QL4 Czsg== 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=enPL/xvbqmsIbruKe5HLP92BDyyBXv8SWMcF1Iwn+vA=; b=NLVOlsttxaGwee3SI+ZFo9dWGBaw9wasjHWqA2oEJQo7O3BfU3JrOI2OcRR4eBhovK GWBeAcK9sMTkb0fNorNNGCgcPR/C36ybaMWa1RbR1rR0qVRQuSG/MmpiODBAqpTZOwOx CezKEZV0y6jNIiJOgsZ74cbJ7X4X07+uSSfg1hgYMMNPycYZh8+23IBZqf425VbgplbZ ahgaGpSu4VO515CyH1ta9O1WLai8RoEByj2F6HpjBY8YQTF/uufsRi4wbIANjDx7i0i/ hNulWbLSjNUfmIYlNyDRlPSjsZ/epqTfqLyky8+asII375bDKnpaJMCcpwaVMRLx5MlE EUQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m9p/Dd9E"; 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 i18si12713483edc.401.2022.01.25.00.27.21; Tue, 25 Jan 2022 00:27:45 -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="m9p/Dd9E"; 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 S3422821AbiAYCcO (ORCPT + 99 others); Mon, 24 Jan 2022 21:32:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59358 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356863AbiAXUVN (ORCPT ); Mon, 24 Jan 2022 15:21:13 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1E3ADB81255; Mon, 24 Jan 2022 20:21:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75E92C340E5; Mon, 24 Jan 2022 20:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055670; bh=w+al1ds14mD9E7dlVSEZTS3IUW3zxxoIo+M8eVMaPqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9p/Dd9Ejq9OOJY8G93s3IDJJFwrkkWJpTQeydqAeFkqvORUQ3PENdizqu/Fg+I0s rniptl8DiK2ifK2UQqyJp64VyDze7yl8NgYYiaOyaummX1mtM8tXT4WHdyHpvFtsow Kw7zSZYkGQtnU0q8VfQSkGVsGP/oGWdhvX9tDKl8= 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.15 228/846] x86/uaccess: Move variable into switch case statement Date: Mon, 24 Jan 2022 19:35:45 +0100 Message-Id: <20220124184108.791124882@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 5c95d242f38d7..bb1430283c726 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