init_super1() memset full buffer allocated for superblock

Avoid possibly using stale data in bitmap and misc area of superblock.
In addition, remove superfluous memsets already covered by memset of
full superblock.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2012-03-21 08:00:26 +11:00 committed by NeilBrown
parent 4122675629
commit 1afa9308d2
1 changed files with 1 additions and 2 deletions

View File

@ -848,7 +848,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
": %s could not allocate superblock\n", __func__);
return 0;
}
memset(sb, 0, MAX_SB_SIZE);
memset(sb, 0, SUPER1_SIZE);
st->sb = sb;
if (info == NULL) {
@ -883,7 +883,6 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
sprintf(defname, "%d", info->md_minor);
name = defname;
}
memset(sb->set_name, 0, 32);
if (homehost &&
strchr(name, ':')== NULL &&
strlen(homehost)+1+strlen(name) < 32) {