Linux MM tree latest commits
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
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
Subject: + list-add-missing-empty-list-check-to-list_cut_before.patch added to mm-nonmm-unstable branch
Date: Mon, 30 Nov 2026 17:40:55 -0800	[thread overview]
Message-ID: <20261201014055.EEF151F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261130032224.15372-2-zhangcoder@yeah.net>


The patch titled
     Subject: list: add missing empty list check to list_cut_before()
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     list-add-missing-empty-list-check-to-list_cut_before.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/list-add-missing-empty-list-check-to-list_cut_before.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 <zhangcoder@yeah.net>
Subject: list: add missing empty list check to list_cut_before()
Date: Mon, 30 Nov 2026 11:22:23 +0800

Patch series "list: add missing empty list check to list_cut_before()", v4.

Patch 1 adds the missing list_empty() guard; patch 2 adds a KUnit
test case.


This patch (of 2):

list_cut_before() lacks the list_empty() guard present in
list_cut_position().  With an empty head, the function falls through
to the pointer updates instead of returning early.

Both helpers share the same kernel-doc wording:

  'You should pass on @entry an element you know is on @head.'

Nevertheless, list_cut_position() returns early for an empty head,
and list_splice() also checks its source list before doing any
pointer updates.  Make list_cut_before() consistent with them for
the empty-list case.

Link: https://lore.kernel.org/20261130032224.15372-1-zhangcoder@yeah.net
Link: https://patch.msgid.link/20261130032224.15372-2-zhangcoder@yeah.net
Signed-off-by: Ziran Zhang <zhangcoder@yeah.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David Gow <david@davidgow.net>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Jordan R Abrahams-Whitehead <ajordanr@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Nilay Shroff <nilay@linux.ibm.com>
Cc: Edward Cree <ecree@solarflare.com>
Cc: Simona Vetter <simona.vetter@ffwll.ch>

 include/linux/list.h |    5 +++++
 1 file changed, 5 insertions(+)

--- a/include/linux/list.h~list-add-missing-empty-list-check-to-list_cut_before
+++ a/include/linux/list.h
@@ -555,6 +555,11 @@ static inline void list_cut_before(struc
 				   struct list_head *head,
 				   struct list_head *entry)
 {
+	if (list_empty(head)) {
+		INIT_LIST_HEAD(list);
+		return;
+	}
+
 	if (head->next == entry) {
 		INIT_LIST_HEAD(list);
 		return;
_

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


           reply	other threads:[~2026-12-01  1:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20261130032224.15372-2-zhangcoder@yeah.net>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201014055.EEF151F00893@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=ajordanr@google.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=david@davidgow.net \
    --cc=dhowells@redhat.com \
    --cc=ecree@solarflare.com \
    --cc=elver@google.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=nilay@linux.ibm.com \
    --cc=paulmck@kernel.org \
    --cc=simona.vetter@ffwll.ch \
    --cc=zhangcoder@yeah.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox