lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABVgOSkh2ZBcUGzVCEg0mtz8_kG_Z2hpNMUJCmS+bOH7ryTf4A@mail.gmail.com>
Date: Sat, 16 Nov 2024 05:26:37 +0800
From: David Gow <davidgow@...gle.com>
To: Kuan-Wei Chiu <visitorckw@...il.com>
Cc: brendanhiggins@...gle.com, rmoar@...gle.com, ruanjinjie@...wei.com, 
	jserv@...s.ncku.edu.tw, linux-kselftest@...r.kernel.org, 
	kunit-dev@...glegroups.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kunit: debugfs: Use IS_ERR() for alloc_string_stream()
 error check

On Fri, 15 Nov 2024 at 00:56, Kuan-Wei Chiu <visitorckw@...il.com> wrote:
>
> The alloc_string_stream() function only returns ERR_PTR(-ENOMEM) on
> failure and never returns NULL. Therefore, switching the error check in
> the caller from IS_ERR_OR_NULL to IS_ERR improves clarity, indicating
> that this function will return an error pointer (not NULL) when an
> error occurs. This change avoids any ambiguity regarding the function's
> return behavior.
>
> Link: https://lore.kernel.org/lkml/Zy9deU5VK3YR+r9N@visitorckw-System-Product-Name
> Signed-off-by: Kuan-Wei Chiu <visitorckw@...il.com>
> --

Makes sense to me, thanks.

Reviewed-by: David Gow <davidgow@...gle.com>

Cheers,
-- David

>  lib/kunit/debugfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c
> index d548750a325a..6273fa9652df 100644
> --- a/lib/kunit/debugfs.c
> +++ b/lib/kunit/debugfs.c
> @@ -181,7 +181,7 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite)
>          * successfully.
>          */
>         stream = alloc_string_stream(GFP_KERNEL);
> -       if (IS_ERR_OR_NULL(stream))
> +       if (IS_ERR(stream))
>                 return;
>
>         string_stream_set_append_newlines(stream, true);
> @@ -189,7 +189,7 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite)
>
>         kunit_suite_for_each_test_case(suite, test_case) {
>                 stream = alloc_string_stream(GFP_KERNEL);
> -               if (IS_ERR_OR_NULL(stream))
> +               if (IS_ERR(stream))
>                         goto err;
>
>                 string_stream_set_append_newlines(stream, true);
> --
> 2.34.1
>

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5294 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ