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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF393EB64DD for ; Wed, 12 Jul 2023 16:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbjGLQe7 (ORCPT ); Wed, 12 Jul 2023 12:34:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231986AbjGLQe5 (ORCPT ); Wed, 12 Jul 2023 12:34:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92BCE1711 for ; Wed, 12 Jul 2023 09:34:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 288A1617E4 for ; Wed, 12 Jul 2023 16:34:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B40CC433C8; Wed, 12 Jul 2023 16:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689179691; bh=7xPP/0QNsw8FxyEoVruE+jvZjL/nmchj4VyUCIqaxko=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=saAOJRmrebp1v5jKle+getmG9WAN17OhRHCHSUi6MDdiwp40hZioLcjNXrHaIv68t U++UGOpbVE9VfHCedyg4ZW5VtZlF2MrfBXNw7de0Wtxke67W9MmKUuHxhFXNkPKyDi D0TvdtnGW79VbG3UBAKZ1nOrtHcsdyIF7VgURkaE= Date: Wed, 12 Jul 2023 18:34:48 +0200 From: Greg Kroah-Hartman To: Wang Ming Cc: David Hildenbrand , Akinobu Mita , Andrew Morton , linux-kernel@vger.kernel.org, opensource.kernel@vivo.com Subject: Re: [PATCH v1] lib:Fix an NULL vs IS_ERR() bug for debugfs_create_dir() in err_inject_init() Message-ID: <2023071202-varsity-evasion-580b@gregkh> References: <20230712135226.10041-1-machel@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230712135226.10041-1-machel@vivo.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 12, 2023 at 09:52:11PM +0800, Wang Ming wrote: > The debugfs_create_dir() function returns error pointers. > It never returns NULL. Most incorrect error checks were fixed, > but the one in err_inject_init() was forgotten. > > Fix the remaining error check. > > Signed-off-by: Wang Ming > --- > lib/notifier-error-inject.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/notifier-error-inject.c b/lib/notifier-error-inject.c > index 2b24ea6c9497..c49354c23802 100644 > --- a/lib/notifier-error-inject.c > +++ b/lib/notifier-error-inject.c > @@ -83,7 +83,7 @@ static int __init err_inject_init(void) > notifier_err_inject_dir = > debugfs_create_dir("notifier-error-inject", NULL); > > - if (!notifier_err_inject_dir) > + if (IS_ERR(notifier_err_inject_dir)) > return -ENOMEM; Please do not do any different codepath if a debugfs_*() call fails or succeeds. Why do you need to check this at all? And why are you creating this directory at the root of debugfs? thanks, greg k-h