summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--super-ddf.c3
-rw-r--r--super-intel.c2
-rw-r--r--super0.c1
-rw-r--r--super1.c3
-rw-r--r--util.c6
5 files changed, 11 insertions, 4 deletions
diff --git a/super-ddf.c b/super-ddf.c
index 339db9f..0c2a013 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -820,6 +820,7 @@ static struct supertype *match_metadata_desc_ddf(char *arg)
return NULL;
st = malloc(sizeof(*st));
+ memset(st, 0, sizeof(*st));
st->ss = &super_ddf;
st->max_devs = 512;
st->minor_version = 0;
@@ -837,6 +838,7 @@ static struct supertype *match_metadata_desc_ddf_bvd(char *arg)
return NULL;
st = malloc(sizeof(*st));
+ memset(st, 0, sizeof(*st));
st->ss = &super_ddf_bvd;
st->max_devs = 512;
st->minor_version = 0;
@@ -853,6 +855,7 @@ static struct supertype *match_metadata_desc_ddf_svd(char *arg)
return NULL;
st = malloc(sizeof(*st));
+ memset(st, 0, sizeof(*st));
st->ss = &super_ddf_svd;
st->max_devs = 512;
st->minor_version = 0;
diff --git a/super-intel.c b/super-intel.c
index 8ca491b..263e398 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -157,6 +157,7 @@ static struct supertype *match_metadata_desc_imsm(char *arg)
return NULL;
st = malloc(sizeof(*st));
+ memset(st, 0, sizeof(*st));
st->ss = &super_imsm;
st->max_devs = IMSM_MAX_DEVICES;
st->minor_version = 0;
@@ -175,6 +176,7 @@ static struct supertype *match_metadata_desc_imsm_volume(char *arg)
return NULL;
st = malloc(sizeof(*st));
+ memset(st, 0, sizeof(*st));
st->ss = &super_imsm_volume;
st->max_devs = IMSM_MAX_DEVICES;
st->minor_version = 0;
diff --git a/super0.c b/super0.c
index b0a625b..1ca3536 100644
--- a/super0.c
+++ b/super0.c
@@ -869,6 +869,7 @@ static struct supertype *match_metadata_desc0(char *arg)
struct supertype *st = malloc(sizeof(*st));
if (!st) return st;
+ memset(st, 0, sizeof(*st));
st->ss = &super0;
st->info = NULL;
st->minor_version = 90;
diff --git a/super1.c b/super1.c
index 211be82..0fe54e9 100644
--- a/super1.c
+++ b/super1.c
@@ -1073,8 +1073,8 @@ static int load_super1(struct supertype *st, int fd, char *devname)
struct supertype tst;
__u64 bestctime = 0;
/* guess... choose latest ctime */
+ memset(&tst, 0, sizeof(tst));
tst.ss = &super1;
- tst.sb = NULL;
for (tst.minor_version = 0; tst.minor_version <= 2 ; tst.minor_version++) {
switch(load_super1(&tst, fd, devname)) {
case 0: super = tst.sb;
@@ -1216,6 +1216,7 @@ static struct supertype *match_metadata_desc1(char *arg)
struct supertype *st = malloc(sizeof(*st));
if (!st) return st;
+ memset(st, 0, sizeof(*st));
st->ss = &super1;
st->max_devs = 384;
st->sb = NULL;
diff --git a/util.c b/util.c
index 365e66b..08c6bb0 100644
--- a/util.c
+++ b/util.c
@@ -841,6 +841,7 @@ struct supertype *dup_super(struct supertype *orig)
st = malloc(sizeof(*st));
if (!st)
return st;
+ memset(st, 0, sizeof(*st));
st->ss = orig->ss;
st->max_devs = orig->max_devs;
st->minor_version = orig->minor_version;
@@ -861,11 +862,10 @@ struct supertype *guess_super(int fd)
int i;
st = malloc(sizeof(*st));
- memset(st, 0, sizeof(*st));
for (i=0 ; superlist[i]; i++) {
int rv;
ss = superlist[i];
- st->ss = NULL;
+ memset(st, 0, sizeof(*st));
rv = ss->load_super(st, fd, NULL);
if (rv == 0) {
struct mdinfo info;
@@ -880,7 +880,7 @@ struct supertype *guess_super(int fd)
}
if (bestsuper != -1) {
int rv;
- st->ss = NULL;
+ memset(st, 0, sizeof(*st));
rv = superlist[bestsuper]->load_super(st, fd, NULL);
if (rv == 0) {
superlist[bestsuper]->free_super(st);