imsm_num_data_members() can indicate error by returning 0 value In such case size cannot be set based on 0 value. Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx> --- super-intel.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/super-intel.c b/super-intel.c index d6c2756..f604589 100644 --- a/super-intel.c +++ b/super-intel.c @@ -5178,15 +5178,22 @@ static int imsm_set_array_state(struct active_array *a, int consistent) struct mdinfo *mdi; used_disks = imsm_num_data_members(dev, -1); - array_blocks = map->blocks_per_member * used_disks; - /* round array size down to closest MB */ - array_blocks = (array_blocks >> SECT_PER_MB_SHIFT) - << SECT_PER_MB_SHIFT; - a->info.custom_array_size = array_blocks/2; - a->check_reshape = 1; /* encourage manager to update - * array size - */ - + if (used_disks > 0) { + array_blocks = + map->blocks_per_member * + used_disks; + /* round array size down to closest MB + */ + array_blocks = (array_blocks + >> SECT_PER_MB_SHIFT) + << SECT_PER_MB_SHIFT; + a->info.custom_array_size = + array_blocks/2; + /* encourage manager to update array + * size + */ + a->check_reshape = 1; + } /* finalize online capacity expansion/reshape */ for (mdi = a->info.devs; mdi; mdi = mdi->next) imsm_set_disk(a, -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html