diff options
author | Dan Williams <dan.j.williams@intel.com> | 2010-07-01 17:36:05 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-07-01 17:36:05 -0700 |
commit | 8cfc801c72f079618b39d04c2e0fe32adbc2474e (patch) | |
tree | 061c0e2348bd7fab99ca774fbcf758ebf997ae06 /super-ddf.c | |
parent | 6a0ee6a0770e8b2ae2a2bbe79896d4ecb083e218 (diff) | |
parent | aa534678baad80689a642ba1bd602a00a267ac03 (diff) | |
download | mdadm-8cfc801c72f079618b39d04c2e0fe32adbc2474e.tar.gz mdadm-8cfc801c72f079618b39d04c2e0fe32adbc2474e.tar.xz mdadm-8cfc801c72f079618b39d04c2e0fe32adbc2474e.zip |
Merge branch 'subarray' into for-neil
Conflicts:
mdadm.h
super-intel.c
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/super-ddf.c b/super-ddf.c index 3feea57..736e07f 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -783,6 +783,10 @@ static int load_super_ddf(struct supertype *st, int fd, if (get_dev_size(fd, devname, &dsize) == 0) return 1; + if (test_partition(fd)) + /* DDF is not allowed on partitions */ + return 1; + /* 32M is a lower bound */ if (dsize <= 32*1024*1024) { if (devname) @@ -841,10 +845,18 @@ static int load_super_ddf(struct supertype *st, int fd, } if (st->subarray[0]) { + unsigned long val; struct vcl *v; + char *ep; + + val = strtoul(st->subarray, &ep, 10); + if (*ep != '\0') { + free(super); + return 1; + } for (v = super->conflist; v; v = v->next) - if (v->vcnum == atoi(st->subarray)) + if (v->vcnum == val) super->currentconf = v; if (!super->currentconf) { free(super); @@ -2866,14 +2878,25 @@ static int load_super_ddf_all(struct supertype *st, int fd, return 1; } if (st->subarray[0]) { + unsigned long val; struct vcl *v; + char *ep; + + val = strtoul(st->subarray, &ep, 10); + if (*ep != '\0') { + free(super); + return 1; + } for (v = super->conflist; v; v = v->next) - if (v->vcnum == atoi(st->subarray)) + if (v->vcnum == val) super->currentconf = v; - if (!super->currentconf) + if (!super->currentconf) { + free(super); return 1; + } } + *sbp = super; if (st->ss == NULL) { st->ss = &super_ddf; |