diff options
| author | Jakob Koschel <[email protected]> | 2022-04-29 21:37:59 +0000 |
|---|---|---|
| committer | akpm <[email protected]> | 2022-04-29 21:37:59 +0000 |
| commit | 04d168c6d42d1772d35372301a14bb20784c81c5 (patch) | |
| tree | cb41196d837fdad345d2220df295a267706dff0f /lib/test_string.c | |
| parent | ocfs2: rewrite error handling of ocfs2_fill_super (diff) | |
| download | kernel-04d168c6d42d1772d35372301a14bb20784c81c5.tar.gz kernel-04d168c6d42d1772d35372301a14bb20784c81c5.zip | |
fs/proc/kcore.c: remove check of list iterator against head past the loop body
When list_for_each_entry() completes the iteration over the whole list
without breaking the loop, the iterator value will be a bogus pointer
computed based on the head element.
While it is safe to use the pointer to determine if it was computed based
on the head element, either with list_entry_is_head() or &pos->member ==
head, using the iterator variable after the loop should be avoided.
In preparation to limit the scope of a list iterator to the list traversal
loop, use a dedicated pointer to point to the found element [1].
[[email protected]: reduce scope of `iter']
Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Jakob Koschel <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: "Brian Johannesmeyer" <[email protected]>
Cc: Cristiano Giuffrida <[email protected]>
Cc: "Bos, H.J." <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/test_string.c')
0 files changed, 0 insertions, 0 deletions
