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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+GJov7BUm4BnWh9m6+hCQRBQ2OW=UwoB9z3dMcFWKRqz44O=g@mail.gmail.com>
Date: Tue, 23 Apr 2024 17:35:02 -0400
From: Rae Moar <rmoar@...gle.com>
To: Ivan Orlov <ivan.orlov0322@...il.com>
Cc: brendan.higgins@...ux.dev, davidgow@...gle.com, 
	linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kunit: string-stream-test: use KUNIT_DEFINE_ACTION_WRAPPER

On Tue, Apr 23, 2024 at 2:27 PM Ivan Orlov <ivan.orlov0322@...il.com> wrote:
>
> Use KUNIT_DEFINE_ACTION_WRAPPER macro to define the 'kfree' and
> 'string_stream_destroy' wrappers for kunit_add_action.
>
> Signed-off-by: Ivan Orlov <ivan.orlov0322@...il.com>

Hello!

This looks like a good use of the macro. Thanks!

Reviewed-by: Rae Moar <rmoar@...gle.com>

Thanks!
-Rae

> ---
>  lib/kunit/string-stream-test.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/lib/kunit/string-stream-test.c b/lib/kunit/string-stream-test.c
> index 03fb511826f7..7511442ea98f 100644
> --- a/lib/kunit/string-stream-test.c
> +++ b/lib/kunit/string-stream-test.c
> @@ -22,18 +22,10 @@ struct string_stream_test_priv {
>  };
>
>  /* Avoids a cast warning if kfree() is passed direct to kunit_add_action(). */
> -static void kfree_wrapper(void *p)
> -{
> -       kfree(p);
> -}
> +KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *);
>
>  /* Avoids a cast warning if string_stream_destroy() is passed direct to kunit_add_action(). */
> -static void cleanup_raw_stream(void *p)
> -{
> -       struct string_stream *stream = p;
> -
> -       string_stream_destroy(stream);
> -}
> +KUNIT_DEFINE_ACTION_WRAPPER(cleanup_raw_stream, string_stream_destroy, struct string_stream *);
>
>  static char *get_concatenated_string(struct kunit *test, struct string_stream *stream)
>  {
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ