Commit 0e40852
FROMLIST: staging: android: ashmem: remove usage of list iterator after the loop body
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].
Before, the code implicitly used the head when no element was found
when using &pos->list. Since the new variable is only set if an
element was found, the head needs to be used explicitly if the
variable is NULL.
Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1]
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifaf19dd876a513a1952fac448079d664aebdf604
(cherry picked from commit 4f49a861af661e062c65f79fff181b804e61e7a3)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>1 parent 2baa690 commit 0e40852
1 file changed
Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
706 | | - | |
| 706 | + | |
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
710 | | - | |
| 710 | + | |
711 | 711 | | |
712 | | - | |
| 712 | + | |
| 713 | + | |
713 | 714 | | |
| 715 | + | |
714 | 716 | | |
715 | 717 | | |
716 | 718 | | |
717 | 719 | | |
718 | 720 | | |
719 | | - | |
| 721 | + | |
720 | 722 | | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
726 | 728 | | |
727 | 729 | | |
728 | 730 | | |
729 | 731 | | |
| 732 | + | |
730 | 733 | | |
731 | 734 | | |
732 | 735 | | |
| |||
0 commit comments