From: Lukasz Dorau Date: Fri, 14 Sep 2012 14:20:31 +0000 (+0200) Subject: fix: imsm: do not accept too small sizes X-Git-Tag: mdadm-3.3-rc1~220 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=65d0b4ce2d5f98081bb456c600c27a28f5f6f54f fix: imsm: do not accept too small sizes Inappriopriate error messages (e.g. mdadm: platform does not support raid5 with 0 disk) have been displayed when too small size was given. This patch fixes it. Signed-off-by: Lukasz Dorau Signed-off-by: NeilBrown --- diff --git a/super-intel.c b/super-intel.c index 1d366131..107550fd 100644 --- a/super-intel.c +++ b/super-intel.c @@ -9744,6 +9744,13 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st, get_imsm_raid_level(dev->vol.map), chunk * 1024, geo->size * 2); + if (geo->size == 0) { + pr_err("Error. Size expansion is " \ + "supported only (current size is %llu, " \ + "requested size /rounded/ is 0).\n", + current_size); + goto analyse_change_exit; + } } if ((current_size != geo->size) && (geo->size > 0)) {