From: Ziran Zhang <zhangcoder@yeah.net>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
David Howells <dhowells@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Jordan R Abrahams-Whitehead <ajordanr@google.com>,
Marco Elver <elver@google.com>,
Nilay Shroff <nilay@linux.ibm.com>,
Edward Cree <ecree@solarflare.com>,
Simona Vetter <simona.vetter@ffwll.ch>,
linux-kernel@vger.kernel.org, Ziran Zhang <zhangcoder@yeah.net>
Subject: Re: [PATCH v2 1/2] list: add missing empty list check to list_cut_before()
Date: Fri, 18 Sep 2026 00:14:56 +0800 [thread overview]
Message-ID: <20260917161456.9181-1-zhangcoder@yeah.net> (raw)
In-Reply-To: <aqwFiYq_SjheX3T4@ashevche-desk.local>
On Thu, 17 Sep 2026 18:21:45 +0300, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> The kernel-doc specifically says:
>
> 'You should pass in @entry an element you know is on @head.'
>
> Do you have a real life example?
No, I do not have a real life example. It was based on code
analysis only.
> The room of the lines for the body of the commit message is ~72
> characters and not 56.
Noted, I will keep that in mind for future patches.
> What makes it different to the similar cases in list_splice(), for
> example?
list_splice() has an empty-list check too, on its source list:
if (!list_empty(list))
__list_splice(list, head, head->next);
list_cut_position() does the same for its source list:
if (list_empty(head))
return;
But list_cut_position() has the same kernel-doc wording:
'You should pass on @entry an element you know is on @head.'
and still returns early for an empty head.
So list_cut_position() handles an empty head before doing any pointer
updates, even though the kernel-doc contract only requires @entry to
be on @head. My patch makes list_cut_before() do the same.
I agree this is a defensive change, not a bug fix. If the consensus
is to rely strictly on the caller contract, I will drop this series.
For list_cut_before() specifically, making it match list_cut_position()
seemed reasonable.
Thanks,
Ziran Zhang
next prev parent reply other threads:[~2026-09-17 16:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 12:55 [PATCH v2 0/2] list: add missing empty list check to list_cut_before() Ziran Zhang
2026-09-17 12:55 ` [PATCH v2 1/2] " Ziran Zhang
2026-09-17 15:21 ` Andy Shevchenko
2026-09-17 16:14 ` Ziran Zhang [this message]
2026-09-18 6:06 ` Andy Shevchenko
2026-09-17 12:55 ` [PATCH v2 2/2] list: add KUnit test for list_cut_before() empty list case Ziran Zhang
2026-09-18 7:33 ` Andy Shevchenko
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=20260917161456.9181-1-zhangcoder@yeah.net \
--to=zhangcoder@yeah.net \
--cc=ajordanr@google.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=dhowells@redhat.com \
--cc=ecree@solarflare.com \
--cc=elver@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nilay@linux.ibm.com \
--cc=paulmck@kernel.org \
--cc=simona.vetter@ffwll.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.