Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1299987pxu; Mon, 23 Nov 2020 17:34:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7RCwAVN7m0Sz6HNhLWSgZb2vKf7DlG0EYfm849M3TbAOhgN8hnozONlpydDD6a6ra0yNm X-Received: by 2002:a17:906:9816:: with SMTP id lm22mr2224401ejb.313.1606181692054; Mon, 23 Nov 2020 17:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606181692; cv=none; d=google.com; s=arc-20160816; b=NAYEenibP1GM4dlo+ICJGp+bCqiyVG2EqFLU4tW1F+9QFo4fXbCpnMGYlMxqfmtIbD 5SmbDefnnwPl+/mexBWaLLK3K4m14eTDVFQ5C9JT+mb84t/WKJfLrSqFYS/bF2bROxN+ F+TxJHl08+lIRC2LBksF+oLdZzN1PM474K3MXZnKCZvxbrirAlPZPRYbQsO6tBTyDVGZ cutqEvvlxoYUwSxIRVggdOiIVunWxMa9Te643jUT9mZRkbXsdlrDxqTY8yGs+rpa2/+d Wcb60m2BRukTQLsR+O1lu82L6U1N1tawQSLY/mQA3PsWLjCmNhLI4biKW5iihu0DrRJf 5FGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1Fpt+3NGNjcuXPoKd+YKzvfWCCI+i2QS11ln4xb/K2c=; b=j5rZUNACfKLchsYpaBiEJ+Az88RVWYmaTtNX+LWovM3+OKgPnmIRiL8O3l8vqiEQUV QuDpJZgiUiB81689TBLUHfJS/yrHP05hGyTuyz6dJQvoyWIl/pqYHZy64EMyhAAW53s4 yBK+Z7YSZGcBDiwNcYQfYOzF1uVjEHzyee++FZ5V3kqq3thOmfdvQHvFDCcES3EnG3Cl SstJLWj9u+0PSksaEPXvhgJOrE9zB+P2sO7A3hQuHrmxCgvmJsCZmazH9RLyutR8S1EN XYE4nJGm2UTJkvAnUwhXmLrFAStnIkZcMACF5rYum8ilxXXwmHVmbqBlwq9qP0VCovRL HiuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mZ10EKN9; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si5910500ejx.640.2020.11.23.17.34.22; Mon, 23 Nov 2020 17:34:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@google.com header.s=20161025 header.b=mZ10EKN9; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbgKXBdG (ORCPT + 99 others); Mon, 23 Nov 2020 20:33:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729350AbgKXBdF (ORCPT ); Mon, 23 Nov 2020 20:33:05 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D833C061A53 for ; Mon, 23 Nov 2020 17:33:05 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id w187so2304689pfd.5 for ; Mon, 23 Nov 2020 17:33:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1Fpt+3NGNjcuXPoKd+YKzvfWCCI+i2QS11ln4xb/K2c=; b=mZ10EKN9Q6HwSmECmmsUHbUHF/oTLT4c/YpQVGCE0gPLnlz6SgHQW3ieQ7zeUHJnUi XUPs+F1GoZaFLBKWU3CvMTPUTS8a5+RdM3NBjgdsJpNB5L7Gee8a5rDblh6bnWIWT9TK uir+AjWjaGJnRAA0K84IM0yu+WQnaSePUaJNJPiE7LfLBhB3Pd0A4gWblql3Lao7defI n9Uw15itvZVSId22hyle+f6GM1M4THjCwMgL7v1hyU5f7oNm+YC3/Fk6KnTIGBq7Lgby +eM5Ju8Jh9l5BxBe3HwjA5bt+bnUjVm7e9zM9zQUlIbVcSVLiqKYS2m+arIIzBAIXu/j s+uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1Fpt+3NGNjcuXPoKd+YKzvfWCCI+i2QS11ln4xb/K2c=; b=ZB6Y1Ob7o4k6GvbSr4SkwMVU6Y5hkZIRcI1eO3GQuvSZC2hgf5HvYsiTqVyk/d1kz3 YEQIcWJlVBtvkv9Y+d3AH7bh+LmJannJWubw6HKfsc3WQQ2A5vNkVXVSaDTy9BASa7Rx Yk6j1nsOS2a7nZ9wAwVJKeMXdqK0Envb1tmYwBrtxoLweagYwrbsqZE/QfF0joc56GVb DC9uApi7G6Lmq+luLpc7n2QK/FXNoPklhGHLqP/FoBH531avhedOUZ/UgDQ9/5oH746p vAFTBwzGcU/v6K4E6It7tQTvl65G2/L5l4xplKokWNWdtRMe+TXHhTtzmwi2zR7j6uCM oWJw== X-Gm-Message-State: AOAM532NWykqMzcF8CFWKj7RfZT6C44spnvWG3DdIBQ2dhbM5PKggXjZ MP0FsHzZBYjX5QxTenIod2rEZBcmD95pnhnnLlqILA== X-Received: by 2002:a65:6a4e:: with SMTP id o14mr1859973pgu.263.1606181584110; Mon, 23 Nov 2020 17:33:04 -0800 (PST) MIME-Version: 1.0 References: <20201120105344.4345c14e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <202011201129.B13FDB3C@keescook> <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <202011220816.8B6591A@keescook> In-Reply-To: <202011220816.8B6591A@keescook> From: Nick Desaulniers Date: Mon, 23 Nov 2020 17:32:51 -0800 Message-ID: Subject: Re: [PATCH 000/141] Fix fall-through warnings for Clang To: Kees Cook Cc: Jakub Kicinski , "Gustavo A. R. Silva" , LKML , alsa-devel@alsa-project.org, amd-gfx list , bridge@lists.linux-foundation.org, ceph-devel@vger.kernel.org, cluster-devel@redhat.com, coreteam@netfilter.org, devel@driverdev.osuosl.org, dm-devel@redhat.com, drbd-dev@lists.linbit.com, dri-devel , GR-everest-linux-l2@marvell.com, GR-Linux-NIC-Dev@marvell.com, intel-gfx@lists.freedesktop.org, intel-wired-lan@lists.osuosl.org, keyrings@vger.kernel.org, linux1394-devel@lists.sourceforge.net, linux-acpi@vger.kernel.org, linux-afs@lists.infradead.org, Linux ARM , linux-arm-msm , linux-atm-general@lists.sourceforge.net, linux-block@vger.kernel.org, linux-can@vger.kernel.org, linux-cifs@vger.kernel.org, "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , linux-decnet-user@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-geode@lists.infradead.org, linux-gpio@vger.kernel.org, linux-hams@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-i3c@lists.infradead.org, linux-ide@vger.kernel.org, linux-iio@vger.kernel.org, linux-input@vger.kernel.org, linux-integrity@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, Linux Memory Management List , linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org, Linux-Renesas , linux-scsi@vger.kernel.org, linux-sctp@vger.kernel.org, linux-security-module@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-wireless , Network Development , netfilter-devel@vger.kernel.org, nouveau@lists.freedesktop.org, op-tee@lists.trustedfirmware.org, oss-drivers@netronome.com, patches@opensource.cirrus.com, rds-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, samba-technical@lists.samba.org, selinux@vger.kernel.org, target-devel@vger.kernel.org, tipc-discussion@lists.sourceforge.net, usb-storage@lists.one-eyed-alien.net, virtualization@lists.linux-foundation.org, wcn36xx@lists.infradead.org, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , xen-devel@lists.xenproject.org, linux-hardening@vger.kernel.org, Nathan Chancellor , Miguel Ojeda , Joe Perches Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun, Nov 22, 2020 at 8:17 AM Kees Cook wrote: > > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > > If none of the 140 patches here fix a real bug, and there is no change > > to machine code then it sounds to me like a W=2 kind of a warning. > > FWIW, this series has found at least one bug so far: > https://lore.kernel.org/lkml/CAFCwf11izHF=g1mGry1fE5kvFFFrxzhPSM6qKAO8gxSp=Kr_CQ@mail.gmail.com/ So looks like the bulk of these are: switch (x) { case 0: ++x; default: break; } I have a patch that fixes those up for clang: https://reviews.llvm.org/D91895 There's 3 other cases that don't quite match between GCC and Clang I observe in the kernel: switch (x) { case 0: ++x; default: goto y; } y:; switch (x) { case 0: ++x; default: return; } switch (x) { case 0: ++x; default: ; } Based on your link, and Nathan's comment on my patch, maybe Clang should continue to warn for the above (at least the `default: return;` case) and GCC should change? While the last case looks harmless, there were only 1 or 2 across the tree in my limited configuration testing; I really think we should just add `break`s for those. -- Thanks, ~Nick Desaulniers