The patch titled Subject: fs/binfmt_elf.c: use list_for_each_entry() has been added to the -mm tree. Its filename is elf-use-list_for_each_entry.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/elf-use-list_for_each_entry.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/elf-use-list_for_each_entry.patch 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 and is updated there every 3-4 working days ------------------------------------------------------ From: Alexey Dobriyan <adobriyan@xxxxxxxxx> Subject: fs/binfmt_elf.c: use list_for_each_entry() Link: http://lkml.kernel.org/r/20190204202800.GB27482@avx2 Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/fs/binfmt_elf.c~elf-use-list_for_each_entry +++ a/fs/binfmt_elf.c @@ -2030,7 +2030,6 @@ static int fill_note_info(struct elfhdr struct elf_note_info *info, const kernel_siginfo_t *siginfo, struct pt_regs *regs) { - struct list_head *t; struct core_thread *ct; struct elf_thread_status *ets; @@ -2047,10 +2046,9 @@ static int fill_note_info(struct elfhdr list_add(&ets->list, &info->thread_list); } - list_for_each(t, &info->thread_list) { + list_for_each_entry(ets, &info->thread_list, list) { int sz; - ets = list_entry(t, struct elf_thread_status, list); sz = elf_dump_thread_status(siginfo->si_signo, ets); info->thread_status_size += sz; } @@ -2114,18 +2112,15 @@ static size_t get_note_info_size(struct static int write_note_info(struct elf_note_info *info, struct coredump_params *cprm) { + struct elf_thread_status *ets; int i; - struct list_head *t; for (i = 0; i < info->numnote; i++) if (!writenote(info->notes + i, cprm)) return 0; /* write out the thread status notes section */ - list_for_each(t, &info->thread_list) { - struct elf_thread_status *tmp = - list_entry(t, struct elf_thread_status, list); - + list_for_each_entry(ets, &info->thread_list, list) { for (i = 0; i < tmp->num_notes; i++) if (!writenote(&tmp->notes[i], cprm)) return 0; _ Patches currently in -mm which might be from adobriyan@xxxxxxxxx are mm-shuffle-gfp_-flags.patch proc-return-exit-code-4-for-skipped-tests.patch proc-read-kernel-cpu-stat-pointer-once.patch proc-use-seq_puts-everywhere.patch elf-dont-be-afraid-of-overflow.patch elf-use-list_for_each_entry.patch elf-spread-const-a-little.patch proc-calculate-end-pointer-for-proc-lookup-at-compile-time.patch