The patch titled Subject: lib/list-test: add a test for the 'list' doubly linked list has been added to the -mm tree. Its filename is lib-list-test-add-a-test-for-the-list-doubly-linked-list-v3.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-list-test-add-a-test-for-the-list-doubly-linked-list-v3.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-list-test-add-a-test-for-the-list-doubly-linked-list-v3.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Gow <davidgow@xxxxxxxxxx> Subject: lib/list-test: add a test for the 'list' doubly linked list This revision fixes some issues with the memory allocation in the 'list_test_list_init' test. In particular, it uses a KUnit assert to verify that the lists allocated with kmalloc() and kzalloc() are non-NULL (and also properly passes GFP_KERNEL to them). Link: http://lkml.kernel.org/r/20191016215707.95317-1-davidgow@xxxxxxxxxx Signed-off-by: David Gow <davidgow@xxxxxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Cc: Brendan Higgins <brendanhiggins@xxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/list-test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/lib/list-test.c~lib-list-test-add-a-test-for-the-list-doubly-linked-list-v3 +++ a/lib/list-test.c @@ -25,10 +25,12 @@ static void list_test_list_init(struct k INIT_LIST_HEAD(&list2); - list4 = kzalloc(sizeof(*list4), 0); + list4 = kzalloc(sizeof(*list4), GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, list4); INIT_LIST_HEAD(list4); - list5 = kmalloc(sizeof(*list5), 0); + list5 = kmalloc(sizeof(*list5), GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, list5); memset(list5, 0xFF, sizeof(*list5)); INIT_LIST_HEAD(list5); @@ -665,7 +667,7 @@ static void list_test_list_for_each_entr KUNIT_EXPECT_EQ(test, cur->data, i); i++; } - + KUNIT_EXPECT_EQ(test, i, 5); } @@ -686,7 +688,7 @@ static void list_test_list_for_each_entr KUNIT_EXPECT_EQ(test, cur->data, i); i--; } - + KUNIT_EXPECT_EQ(test, i, -1); } _ Patches currently in -mm which might be from davidgow@xxxxxxxxxx are lib-list-test-add-a-test-for-the-list-doubly-linked-list.patch lib-list-test-add-a-test-for-the-list-doubly-linked-list-v3.patch