[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2023071202-varsity-evasion-580b@gregkh>
Date: Wed, 12 Jul 2023 18:34:48 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Wang Ming <machel@...o.com>
Cc: David Hildenbrand <david@...hat.com>,
Akinobu Mita <akinobu.mita@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, opensource.kernel@...o.com
Subject: Re: [PATCH v1] lib:Fix an NULL vs IS_ERR() bug for
debugfs_create_dir() in err_inject_init()
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 <machel@...o.com>
> ---
> 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
Powered by blists - more mailing lists