From: NeilBrown Date: Mon, 3 Nov 2014 22:35:20 +0000 (+1100) Subject: Detail: fix handling of 'disks' array. X-Git-Tag: mdadm-3.3.3~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8057db46a15d;p=thirdparty%2Fmdadm.git Detail: fix handling of 'disks' array. Since the introduction of replacement devices, we reserve to places in the "disks" array for each raid disk. That means we should allocate to twice "max_disk" as the array could have that many raid_disks (though that would limit the number of replacements). A couple of other places need to use "max_disks*2" instead of "max_disks" to co-ordinate with this. Reported-by: Or Sagi Signed-off-by: NeilBrown --- diff --git a/Detail.c b/Detail.c index c4fcad96..dd72eded 100644 --- a/Detail.c +++ b/Detail.c @@ -295,8 +295,8 @@ int Detail(char *dev, struct context *c) goto out; } - disks = xmalloc(max_disks * sizeof(mdu_disk_info_t)); - for (d = 0; d < max_disks; d++) { + disks = xmalloc(max_disks * 2 * sizeof(mdu_disk_info_t)); + for (d = 0; d < max_disks * 2; d++) { disks[d].state = (1<= 0 && disk.raid_disk < array.raid_disks && disks[disk.raid_disk*2+1].state == (1<