From: Kaitao Cheng The safe list iterator in dir_utime() requires a temporary cursor even though the loop body only deletes and frees the current entry. The mutable iterator keeps the same removal-safe traversal semantics while hiding the internal cursor from the call site. Switch dir_utime() to list_for_each_entry_mutable() and drop the unused temporary cursor variable. No functional change is intended. Signed-off-by: Kaitao Cheng --- init/initramfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/init/initramfs.c b/init/initramfs.c index 20a18fcda48e..e226d7eb1257 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -167,8 +167,9 @@ static void __init dir_add(const char *name, size_t nlen, time64_t mtime) static void __init dir_utime(void) { - struct dir_entry *de, *tmp; - list_for_each_entry_safe(de, tmp, &dir_list, list) { + struct dir_entry *de; + + list_for_each_entry_mutable(de, &dir_list, list) { list_del(&de->list); do_utime(de->name, de->mtime); kfree(de); -- 2.43.0