From: Labun, Marcin Date: Thu, 10 Mar 2011 00:50:54 +0000 (+1100) Subject: imsm: add maximum number of disk validation in RAID array X-Git-Tag: mdadm-3.2.1~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=73408129505ddddc2559ec944ae83c6a1c8ec0f6;p=thirdparty%2Fmdadm.git imsm: add maximum number of disk validation in RAID array Arrays exceeding the OROM/EFI maximum number of supported disk are blocked in validate_geometry_imsm_orom function. Signed-off-by: Marcin Labun Signed-off-by: NeilBrown --- diff --git a/super-intel.c b/super-intel.c index 49649421..663ce2df 100644 --- a/super-intel.c +++ b/super-intel.c @@ -4230,12 +4230,30 @@ static int is_raid_level_supported(const struct imsm_orom *orom, int level, int return 0; } + #define pr_vrb(fmt, arg...) (void) (verbose && fprintf(stderr, Name fmt, ##arg)) +/* + * validate volume parameters with OROM/EFI capabilities + */ static int validate_geometry_imsm_orom(struct intel_super *super, int level, int layout, int raiddisks, int *chunk, int verbose) { - if (!is_raid_level_supported(super->orom, level, raiddisks)) { +#if DEBUG + verbose = 1; +#endif + /* validate container capabilities */ + if (super->orom && raiddisks > super->orom->tds) { + if (verbose) + fprintf(stderr, Name ": %d exceeds maximum number of" + " platform supported disks: %d\n", + raiddisks, super->orom->tds); + return 0; + } + + /* capabilities of OROM tested - copied from validate_geometry_imsm_volume */ + if (super->orom && (!is_raid_level_supported(super->orom, level, + raiddisks))) { pr_vrb(": platform does not support raid%d with %d disk%s\n", level, raiddisks, raiddisks > 1 ? "s" : ""); return 0; @@ -4259,7 +4277,6 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout, layout, level); return 0; } - return 1; }