Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

test_list_sort: fix up const mismatch

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@kernel.org>
Cc: David Gow <davidgow@google.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Kees Cook <kees@kernel.org>
Cc: linux-kernel@vger.kernel.org

Link: https://lore.kernel.org/all/2025121751-backtrack-manifesto-7c57@gregkh/#r
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Greg Kroah-Hartman and committed by
Shuah Khan
90b5f2dc e70a307b

+2 -2
+2 -2
lib/tests/test_list_sort.c
··· 26 26 unsigned int serial; 27 27 }; 28 28 29 - static void check(struct kunit *test, struct debug_el *ela, struct debug_el *elb) 29 + static void check(struct kunit *test, const struct debug_el *ela, const struct debug_el *elb) 30 30 { 31 31 struct debug_el **elts = test->priv; 32 32 ··· 46 46 /* `priv` is the test pointer so check() can fail the test if the list is invalid. */ 47 47 static int cmp(void *priv, const struct list_head *a, const struct list_head *b) 48 48 { 49 - struct debug_el *ela, *elb; 49 + const struct debug_el *ela, *elb; 50 50 51 51 ela = container_of(a, struct debug_el, list); 52 52 elb = container_of(b, struct debug_el, list);