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" <Joe.Lawrence@stratus.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
73e658d8cc
commit
b787bec6bd
|
@ -1383,7 +1383,7 @@ int Assemble(struct supertype *st, char *mddev,
|
||||||
* might allow them to be included, or
|
* might allow them to be included, or
|
||||||
* they will become spares.
|
* they will become spares.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i <= bestcnt; i++) {
|
for (i = 0; i < bestcnt; i++) {
|
||||||
int j = best[i];
|
int j = best[i];
|
||||||
if (j >= 0 && !devices[j].uptodate) {
|
if (j >= 0 && !devices[j].uptodate) {
|
||||||
if (!disk_action_allows(&devices[j].i, st->ss->name, act_re_add))
|
if (!disk_action_allows(&devices[j].i, st->ss->name, act_re_add))
|
||||||
|
|
Loading…
Reference in New Issue