Re: [PATCH] list: add missing empty list check to list_cut_before()
From: Andy Shevchenko
Date: Wed Sep 16 2026 - 06:54:35 EST
On Wed, Sep 16, 2026 at 06:00:01PM +0800, Ziran Zhang wrote:
> list_cut_before() lacks the list_empty() guard present
> in list_cut_position().
>
> With an empty head and an entry not on the list, it
> corrupts the list.
Is it IRL case or the code analysis? If the former, add necessary information
like hardware description (if applicable) and the important ~3-5 lines from
traceback (I assume you rung with CONFIG_LIST_DEBUG=y).
> Add the missing check. When head is empty, initialize
> @list as empty, consistent with the existing
> head->next == entry case.
Nice! Where is the test case?
--
With Best Regards,
Andy Shevchenko