From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18022C3A5A3 for ; Thu, 22 Aug 2019 15:14:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECCEE2082F for ; Thu, 22 Aug 2019 15:14:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389469AbfHVPOw (ORCPT ); Thu, 22 Aug 2019 11:14:52 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:36692 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732150AbfHVPOv (ORCPT ); Thu, 22 Aug 2019 11:14:51 -0400 Received: from callcc.thunk.org (guestnat-104-133-0-111.corp.google.com [104.133.0.111] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x7MFEiSG024985 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Aug 2019 11:14:46 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id A983042049E; Thu, 22 Aug 2019 11:14:44 -0400 (EDT) Date: Thu, 22 Aug 2019 11:14:44 -0400 From: "Theodore Y. Ts'o" To: Austin Kim Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ext4: remove unreachable statement inside __es_insert_extent() Message-ID: <20190822151444.GA7550@mit.edu> Mail-Followup-To: "Theodore Y. Ts'o" , Austin Kim , adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190822063743.GA36528@LGEARND20B15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190822063743.GA36528@LGEARND20B15> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 22, 2019 at 03:37:43PM +0900, Austin Kim wrote: > __es_insert_extent() never returns -EINVAL after BUG is executed. > So remove unreachable code. > --- > fs/ext4/extents_status.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c > index a959adc..7f97360 100644 > --- a/fs/ext4/extents_status.c > +++ b/fs/ext4/extents_status.c > @@ -781,7 +781,6 @@ static int __es_insert_extent(struct inode *inode, struct extent_status *newes) > p = &(*p)->rb_right; > } else { > BUG(); > - return -EINVAL; This would not be safe in the case of !CONFIG_BUG. (See init/Kconfig) It's fair to argue that we shouldn't have CONFIG_BUG --- or !CONFIG_BUG should still cause the kernel to stop without actually printing the full BUG information, for those tiny kernel applications which are really worried about kernel text space. It also would be fair to argue that we should remove the unreachable annotation for BUG(), or even, add a *reachable* annotation to catch code where something something terribly might happen if the kernel is built with !CONFIG_BUG and we trip against a bug. But this is a much higher level issue than your sending individual paches subsystems. Regards, - Ted