Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp685939imu; Wed, 23 Jan 2019 03:59:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN5XoykKar7Ifm5QqUWfeuPvubY1rFKjsmxmD7lPgjLLrFOHZWf9BypMhPdm2DfK9SOwY//5 X-Received: by 2002:a63:f34b:: with SMTP id t11mr1704977pgj.341.1548244792617; Wed, 23 Jan 2019 03:59:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548244792; cv=none; d=google.com; s=arc-20160816; b=jLVxNROQ9RyJSP7hT0k/2elocDFryd5tRReiJOEmt3Df28FZXxycA5+rCzf3KTMRKm HHioWBFAkjdwtBVSx28/yGcJlxV3A7FrODFmz0Qjsg71EOb6c0UjpfmyNSxQk4mm2O+K 2yDHzJbuiD5Ftfg4QavfeaD+qvE89w80gLtb+0ze3XGHUCaVEvK693BBf9ENFm4jo/u5 xVu0fwRiJN8PiPLkdStdwKe2dsBdqipgA0cBTz1EkMH3vGyeQN6GQBR0s8n5TcWzqIxN vhswh6KqEktgQyKlu//dZgDALKPoqSre4ebP+kNJIO7oXsIamVjHpbngmIuuq3fIcekg WLrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7h7tGe6O2V6xITMB9akCWKngFRNz1eBaCDs8nIvrae4=; b=KYnwCTO09RmPJNhJLp/FULHNDBV+W+w1nCAzJXfeDB5qZG1GwN/VzMiB2RoGYz9Bhf j+13w9/0jjnyR3SPVqsXCE+V+SLNkOydTcen6ru51f5IAwz/W0zvcVtIaM/cBdbP/IQ/ dZ5YAPKqEHz3/Khz0/9pYEjKMxescOHD+rbvqvh4yNTN/HDJ9OIU21T//ez+0at+WSAj kQTLjL2+gph6fhv3QU7zXmNM7RS6JvIQrgnwHgnT0mfXwkOcXwrwJHpxidVrEhB7rozG Qt2pHKmFv7zR/wjdK+UWjZtzaLVRKqEbyBpfW7ShLg5XsyjXl2Sk/LYX2pMU2it0bCtg GUlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=muuBFnpL; 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 o16si16722693pgd.117.2019.01.23.03.59.37; Wed, 23 Jan 2019 03:59:52 -0800 (PST) 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=muuBFnpL; 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 S1726934AbfAWL6d (ORCPT + 99 others); Wed, 23 Jan 2019 06:58:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:39770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbfAWL6c (ORCPT ); Wed, 23 Jan 2019 06:58:32 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 45A0A20870; Wed, 23 Jan 2019 11:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548244711; bh=LLGw68OcF7jTXYNq3Xh87u9Jd9LaEbZfXSnSASJOdrs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=muuBFnpLVpcn10SSeFHen/Vdmcf+fEUADEzYwBy2TrXtTsu9RF1VRQzpQKqfok+Ux w7HBhaXM+RfJfagPnk3tqYLOxDqKsO7z8SenVs0oBPzOGo/jdAK0H0BMvWtuu6Zd/P fNEg2uXnn99LTngHnEMOwjlcAD6zTxVkX/IHQ6tA= Date: Wed, 23 Jan 2019 12:58:29 +0100 From: Greg KH To: Kees Cook Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Laura Abbott , Alexander Popov , xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dev@openvswitch.org, linux-kbuild@vger.kernel.org, linux-security-module@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH 1/3] treewide: Lift switch variables out of switches Message-ID: <20190123115829.GA31385@kroah.com> References: <20190123110349.35882-1-keescook@chromium.org> <20190123110349.35882-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190123110349.35882-2-keescook@chromium.org> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 23, 2019 at 03:03:47AM -0800, Kees Cook wrote: > Variables declared in a switch statement before any case statements > cannot be initialized, so move all instances out of the switches. > After this, future always-initialized stack variables will work > and not throw warnings like this: > > fs/fcntl.c: In function ‘send_sigio_to_task’: > fs/fcntl.c:738:13: warning: statement will never be executed [-Wswitch-unreachable] > siginfo_t si; > ^~ That's a pain, so this means we can't have any new variables in { } scope except for at the top of a function? That's going to be a hard thing to keep from happening over time, as this is valid C :( greg k-h