Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796089258; b=svOTvrii6XhuoTEaonx2gOjtoK5NKAXB5wxX3joQ1K1zcBfDBnHUuR0l55aWxJDSKw7H qw7v8AdVwO6x8zbR0B7NUVytttviAl68g+uPrfSAxN4vnOhYlx8AfWS/86VJwlUbaT3pH Vetau0zlQBwRKNqG/03zTQj5fAI8lC/tZGw6z/mNUEbCHLN/H3BCXjYfrOYU6G+HckIYT KxGQUROa/JbJDndsbU1UFyUWCmXQwelnKvH1pvGWTk4DCcM5tNqv52zaQimHWCvP4uTDh LUmHXFObLGvKpzIgGXLmbGm5KgWvG/RQ6abGE+3eCzNeIW1m8ssoD8GyeVjSh5CWoug== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796089258; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=n6FasFYs1Y4SazQwvrd72Ev9QNGSIXefEY5JG4WKhUg=; b=ZVFYthMkS48nt3QuOFGxbhcc7Imt7OiJcwBBwa6HdmCnQJ4H9kCHfxUoyGnPxFT9Q2Sp 1xaiUd5yFmz0l/ULvh/P7Jxrbc9RGSWN5OlV78VZFJCLmtvTsZGYMLZ6k4E+0L1JhPL58 w6KVMQ60G1x9oTpeimPD4fz3/+b/sbFmNn0sjt1dlYoT9Mkzmgx4eoIbcvM3MxgiGsBEm 4/JCUqZYicuu43l4eJ5OrMDdtsXlfbC8SbPerdGohu/jMBoDPNtlYRw7IkBXnceqYiML5 Ufvg/b9W/PWWtXinapTZeOpZdHalTB1LPuqBjvDZIF3DVuKDeemUKbJ4NuxtEWOZ/tg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=e8CTeFyS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1EF0606A31A for ; Tue, 1 Dec 2026 01:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=e8CTeFyS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 306BE1F000C1; Tue, 1 Dec 2026 01:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796089258; bh=n6FasFYs1Y4SazQwvrd72Ev9QNGSIXefEY5JG4WKhUg=; h=Date:To:From:In-Reply-To:References:Subject; b=e8CTeFySZl/65t9fme9WOWLy9XfiPMp4ULGrfMoPYsygU1CmoAuSQKJaBNtOnsibA LFX0o1cF3vNLipQv4cnOo7Pzwulh+DhwE7ntaFH3gvVIXQ2rqinq4odlvHZ8hs7d4j rMpcDHQBqaKND713Y5wInjuPuUzQwF6scHvZQ9l8= Date: Mon, 30 Nov 2026 17:40:57 -0800 To: mm-commits@vger.kernel.org,simona.vetter@ffwll.ch,paulmck@kernel.org, nilay@linux.ibm.com,elver@google.com,ecree@solarflare.com, dhowells@redhat.com,david@davidgow.net,corbet@lwn.net, andriy.shevchenko@linux.intel.com,ajordanr@google.com,zhangcoder@yeah.net, akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261130032224.15372-3-zhangcoder@yeah.net> References: <20261130032224.15372-3-zhangcoder@yeah.net> Subject: + list-add-kunit-test-for-list_cut_before-empty-list-case.patch added to mm-nonmm-unstable branch Message-Id: <20261201014058.306BE1F000C1@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: list: add KUnit test for list_cut_before() empty list case has been added to the -mm mm-nonmm-unstable branch. Its filename is list-add-kunit-test-for-list_cut_before-empty-list-case.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/list-add-kunit-test-for-list_cut_before-empty-list-case.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Ziran Zhang Subject: list: add KUnit test for list_cut_before() empty list case Date: Mon, 30 Nov 2026 11:22:24 +0800 Add a test case covering list_cut_before() with an empty head and an entry not on the list. Without the empty list guard, the call would corrupt the head list. Link: https://patch.msgid.link/20261130032224.15372-3-zhangcoder@yeah.net Signed-off-by: Ziran Zhang Signed-off-by: Andrew Morton Reviewed-by: Andy Shevchenko Acked-by: David Gow Cc: Paul E. McKenney Cc: David Howells Cc: Jonathan Corbet Cc: Jordan R Abrahams-Whitehead Cc: Marco Elver Cc: Nilay Shroff Cc: Edward Cree Cc: Simona Vetter lib/tests/list-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/lib/tests/list-test.c~list-add-kunit-test-for-list_cut_before-empty-list-case +++ a/lib/tests/list-test.c @@ -446,6 +446,23 @@ static void list_test_list_cut_before(st KUNIT_EXPECT_EQ(test, i, 3); } +static void list_test_list_cut_before_empty(struct kunit *test) +{ + LIST_HEAD(entry); + LIST_HEAD(head); + LIST_HEAD(list); + + /* + * entry is initialized but not on head. With an empty head + * this used to corrupt the list. + */ + list_cut_before(&list, &head, &entry); + + KUNIT_EXPECT_TRUE(test, list_empty(&head)); + KUNIT_EXPECT_TRUE(test, list_empty(&list)); + KUNIT_EXPECT_TRUE(test, list_empty(&entry)); +} + static void list_test_list_splice(struct kunit *test) { struct list_head entries[5], *cur; @@ -788,6 +805,7 @@ static struct kunit_case list_test_cases KUNIT_CASE(list_test_list_is_singular), KUNIT_CASE(list_test_list_cut_position), KUNIT_CASE(list_test_list_cut_before), + KUNIT_CASE(list_test_list_cut_before_empty), KUNIT_CASE(list_test_list_splice), KUNIT_CASE(list_test_list_splice_tail), KUNIT_CASE(list_test_list_splice_init), _ Patches currently in -mm which might be from zhangcoder@yeah.net are include-linux-jhashh-fix-kernel-doc-parameter-name.patch list-add-missing-empty-list-check-to-list_cut_before.patch list-add-kunit-test-for-list_cut_before-empty-list-case.patch