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: <CABVgOS=NuoWuP+uOf87+mcgNowXq5BXDv1cwOOAeVipG1A0uAA@mail.gmail.com>
Date: Thu, 18 Dec 2025 14:12:30 +0800
From: David Gow <davidgow@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>, 
	"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, Vlastimil Babka <vbabka@...e.cz>, Kees Cook <kees@...nel.org>
Subject: Re: [PATCH] test_list_sort: fix up const mismatch

On Wed, 17 Dec 2025 at 20:37, Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> In the internal cmp function, a const pointer is cast out to a non-const
> pointer by using container_of().  This is probably not what is intended
> at all, so fix up the const marking to properly preserve what is really
> happening (i.e. the const should flow through the container_of() call)
>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: David Gow <davidgow@...gle.com>
> Cc: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
> Cc: Vlastimil Babka <vbabka@...e.cz>
> Cc: Kees Cook <kees@...nel.org>
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---

Thanks very much!

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

Cheers,
-- David


>  lib/tests/test_list_sort.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/tests/test_list_sort.c b/lib/tests/test_list_sort.c
> index 30879abc8a42..28158557b164 100644
> --- a/lib/tests/test_list_sort.c
> +++ b/lib/tests/test_list_sort.c
> @@ -26,7 +26,7 @@ struct debug_el {
>         unsigned int serial;
>  };
>
> -static void check(struct kunit *test, struct debug_el *ela, struct debug_el *elb)
> +static void check(struct kunit *test, const struct debug_el *ela, const struct debug_el *elb)
>  {
>         struct debug_el **elts = test->priv;
>
> @@ -46,7 +46,7 @@ static void check(struct kunit *test, struct debug_el *ela, struct debug_el *elb
>  /* `priv` is the test pointer so check() can fail the test if the list is invalid. */
>  static int cmp(void *priv, const struct list_head *a, const struct list_head *b)
>  {
> -       struct debug_el *ela, *elb;
> +       const struct debug_el *ela, *elb;
>
>         ela = container_of(a, struct debug_el, list);
>         elb = container_of(b, struct debug_el, list);
> --
> 2.52.0
>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ