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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOSn7-H63BDDQcsZ-c3ZWDCSrP43uY5eYsqG+w2LEGJqODw@mail.gmail.com>
Date:   Fri, 22 Jul 2022 15:12:23 +0800
From:   David Gow <davidgow@...gle.com>
To:     Daniel Latypov <dlatypov@...gle.com>
Cc:     Brendan Higgins <brendanhiggins@...gle.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        KUnit Development <kunit-dev@...glegroups.com>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 2/4] kunit: drop test pointer in string_stream_fragment

On Fri, Jul 22, 2022 at 2:02 AM 'Daniel Latypov' via KUnit Development
<kunit-dev@...glegroups.com> wrote:
>
> We already store the `struct kunit *test` in the string_stream object
> itself, so we need don't need to store a copy of this pointer in every
> fragment in the stream.
>
> Drop it, getting string_stream_fragment down the bare minimum: a
> list_head and the `char *` with the actual fragment.
>
> Signed-off-by: Daniel Latypov <dlatypov@...gle.com>
> ---

Yup, this is definitely redundant now. Thanks!

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

Cheers,
-- David

>  lib/kunit/string-stream.c | 10 +++++-----
>  lib/kunit/string-stream.h |  1 -
>  2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/lib/kunit/string-stream.c b/lib/kunit/string-stream.c
> index a2496abef152..f5ae79c37400 100644
> --- a/lib/kunit/string-stream.c
> +++ b/lib/kunit/string-stream.c
> @@ -22,7 +22,6 @@ static struct string_stream_fragment *alloc_string_stream_fragment(
>         if (!frag)
>                 return ERR_PTR(-ENOMEM);
>
> -       frag->test = test;
>         frag->fragment = kunit_kmalloc(test, len, gfp);
>         if (!frag->fragment)
>                 return ERR_PTR(-ENOMEM);
> @@ -30,11 +29,12 @@ static struct string_stream_fragment *alloc_string_stream_fragment(
>         return frag;
>  }
>
> -static void string_stream_fragment_destroy(struct string_stream_fragment *frag)
> +static void string_stream_fragment_destroy(struct kunit *test,
> +                                          struct string_stream_fragment *frag)
>  {
>         list_del(&frag->node);
> -       kunit_kfree(frag->test, frag->fragment);
> -       kunit_kfree(frag->test, frag);
> +       kunit_kfree(test, frag->fragment);
> +       kunit_kfree(test, frag);
>  }
>
>  int string_stream_vadd(struct string_stream *stream,
> @@ -89,7 +89,7 @@ static void string_stream_clear(struct string_stream *stream)
>                                  frag_container_safe,
>                                  &stream->fragments,
>                                  node) {
> -               string_stream_fragment_destroy(frag_container);
> +               string_stream_fragment_destroy(stream->test, frag_container);
>         }
>         stream->length = 0;
>         spin_unlock(&stream->lock);
> diff --git a/lib/kunit/string-stream.h b/lib/kunit/string-stream.h
> index 494dee0f24bd..b669f9a75a94 100644
> --- a/lib/kunit/string-stream.h
> +++ b/lib/kunit/string-stream.h
> @@ -14,7 +14,6 @@
>  #include <linux/stdarg.h>
>
>  struct string_stream_fragment {
> -       struct kunit *test;
>         struct list_head node;
>         char *fragment;
>  };
> --
> 2.37.1.359.gd136c6c3e2-goog
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@...glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20220721180214.3223778-2-dlatypov%40google.com.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ