From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751528AbdECFoJ (ORCPT ); Wed, 3 May 2017 01:44:09 -0400 Received: from s3.sipsolutions.net ([5.9.151.49]:60860 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbdECFoB (ORCPT ); Wed, 3 May 2017 01:44:01 -0400 Message-ID: <1493790238.2602.3.camel@sipsolutions.net> Subject: Re: [RFC PATCH 8/9] debugfs: defer debugfs_fsdata allocation to first usage From: Johannes Berg To: Nicolai Stange Cc: Greg Kroah-Hartman , "Paul E.McKenney" , linux-kernel@vger.kernel.org Date: Wed, 03 May 2017 07:43:58 +0200 In-Reply-To: <87y3ufvxaz.fsf@gmail.com> (sfid-20170502_220600_227096_F45CC85C) References: <871stdyg0u.fsf@gmail.com> <20170416095137.2784-1-nicstange@gmail.com> <20170416095137.2784-9-nicstange@gmail.com> <1492508204.2472.7.camel@sipsolutions.net> <87y3ufvxaz.fsf@gmail.com> (sfid-20170502_220600_227096_F45CC85C) Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-05-02 at 22:05 +0200, Nicolai Stange wrote: > > So either you could return some valid ops (perhaps > > debugfs_noop_file_operations although those don't have .name or > > .poll, so it doesn't cover everything), or you can just BUG_ON() > > here directly, saving the incomprehensible crash later. > > The purpose of that WARN_ON() there was to turn a potentially > incomprehensible crash into a comprehensible one ;) > > In order to avoid a new BUG_ON(), what about keeping the WARN_ON() as > is and returning NULL instead of the garbage? That would crash > current on first access and the earlier warning would hopefully give > some clue? Yeah, I guess that might work. Probably less harmful to the system than a BUG_ON(), but I still operate under the assumption that there might actually be something mapped at NULL - not sure if that's still true. johannes