From b787bec6bd0ef74a65cc4fab28496996e4a3c12b Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 17 Jun 2011 14:48:33 +1000 Subject: [PATCH] Don't index past the end of 'best' array in Assemble. The 'best' array only has 'bestcnt' entries allocated, so 'i' should always be "< bestcnt", not "<= bestcnt". Reported-by: "Lawrence, Joe" Signed-off-by: NeilBrown --- Assemble.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assemble.c b/Assemble.c index a426afb..25cfec1 100644 --- a/Assemble.c +++ b/Assemble.c @@ -1383,7 +1383,7 @@ int Assemble(struct supertype *st, char *mddev, * might allow them to be included, or * they will become spares. */ - for (i = 0; i <= bestcnt; i++) { + for (i = 0; i < bestcnt; i++) { int j = best[i]; if (j >= 0 && !devices[j].uptodate) { if (!disk_action_allows(&devices[j].i, st->ss->name, act_re_add))