Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp78339rwp; Wed, 12 Jul 2023 09:57:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlEdxusRWrIOu12EuiwibIqsn7X1wyr3It3ijNX4Tzbg6w2/TFGB5VKAxUDRvWN8lSQVL9Hi X-Received: by 2002:a17:90b:4a8e:b0:262:ea3e:e248 with SMTP id lp14-20020a17090b4a8e00b00262ea3ee248mr3466054pjb.7.1689181051158; Wed, 12 Jul 2023 09:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689181051; cv=none; d=google.com; s=arc-20160816; b=qzkfz1k4+HFXeGaCZ8NqmWQ2nujTFx3KPcE28uLD004A99qtLx3ba/XRTB5eMsi4bS jT2+l0sCW25pYqh9Bi4vCbTlIKIKHr0/1BIyD4i/MAChdkqXopmNXiN0mxhSwJAi44yx MEwv8JzPozJ1cVyM7ybdIPhbgEJ3Rzl1q2p7vsM9/9l0ppToap5Zq//dHGCwVMnKwRwP V6O76lYEiSgbIhUsy0pnOSI32PNegApbc1Rt86WN/e9w23cIakFEKmB7HJ+FJmUM5od6 vxt1t281fbzO8HRcYtz7sY2Eir7+6soTZDKj+4Lr8B2YtwgM4eNsC/1Qs7k6eSHrvT8C LL0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+Bc7nkvAqKsrWu0Pt/lLbvylYU8myStPcQGEGKdC8rY=; fh=lr/uyJqnvOZtS7ByJZ+jv7A8o4u0QIsq+KUMsisZ8Mg=; b=uXCxWKV+iaRWlijQY2s6+f7PitWBuy/1t/IHLHy6TvHIM94oxD0XepicF/pqlDZlFS i/vpKmXGenCPqQbIreKy+GscnXrHpkQpzRnlH7Dym9OKhVKPtQE7/pPWBeAPu2Ipc9CK G5ZbaFDL8WQO3SXGlBicPp27cbacTBq/vjuFe8onw2duJG8Mu1p+3qZH8Xy/Bk+q7K42 uyXUUZFtHN4tryIxihb4uIcsib+DcZYhoSMZDJjLRsJmgR9THo7ejBLr0KEYYEDg1lf0 QnyACXWHCawGnk5kIjQzcb2Z2WZJ9XMkluP45g2vH7MHbSZgE1yi/KAAcoLGcK8liuxp NYrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=saAOJRmr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15-20020a17090a930f00b0025ee198e6f7si11318948pjo.168.2023.07.12.09.57.18; Wed, 12 Jul 2023 09:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=saAOJRmr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbjGLQe7 (ORCPT + 99 others); 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> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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