]> git.ipfire.org Git - thirdparty/linux.git/commit
[elf][regset] simplify thread list handling in fill_note_info()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 8 Jun 2020 17:44:16 +0000 (13:44 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 23 Oct 2022 22:06:56 +0000 (18:06 -0400)
commit4b0e21d64253f56fa5b177e08383934680957697
tree5b5475397003b5db67a780c558c21b3601ed9a7e
parent922ef161b21e605bf803f65dc928fabefb735702
[elf][regset] simplify thread list handling in fill_note_info()

fill_note_info() iterates through the list of threads collected in
mm->core_state->dumper, allocating a struct elf_thread_core_info
instance for each and linking those into a list.

We need the entry corresponding to current to be first in the
resulting list, so the logics for list insertion is
if it's for current or list is empty
insert in the head
else
insert after the first element

However, in mm->core_state->dumper the entry for current is guaranteed
to be the first one.  Which means that both parts of condition will
be true on the first iteration and neither will be true on all subsequent
ones.

Taking the first iteration out of the loop simplifies things nicely...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/binfmt_elf.c