Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

UBI: fastmap break out of used PEB search

While searching for PEB matches for each volume in the used PEB list,
the search fails to stop when the PEB is found. This patch adds
a break in the inner loop to stop the search when it is matched.

Signed-off-by: Brian Pomerantz <bapper@gmail.com>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

authored by

Brian Pomerantz and committed by
Artem Bityutskiy
584d4623 95f9a4d2

+3 -1
+3 -1
drivers/mtd/ubi/fastmap.c
··· 727 727 728 728 aeb = NULL; 729 729 list_for_each_entry(tmp_aeb, &used, u.list) { 730 - if (tmp_aeb->pnum == pnum) 730 + if (tmp_aeb->pnum == pnum) { 731 731 aeb = tmp_aeb; 732 + break; 733 + } 732 734 } 733 735 734 736 /* This can happen if a PEB is already in an EBA known