summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2017-08-04 07:30:02 +0200
committerJes Sorensen <jsorensen@fb.com>2017-08-16 14:25:07 +0200
commit6438c249c4fed92cf6e5fb492d19f4c4f516ff6f (patch)
treefb6af6ee9f65700e96efb82c16c122f5b14b336c
parentUse correct syntax for passing DEVLINKS to mdadm from udev (diff)
downloadmdadm-6438c249c4fed92cf6e5fb492d19f4c4f516ff6f.tar.xz
mdadm-6438c249c4fed92cf6e5fb492d19f4c4f516ff6f.zip
super1: only set clustered flag when bitmap is present
If no bitmap is present, then the test if (__le32_to_cpu(bsb->nodes) > 1) accesses uninitialised memory. So move that test inside a test for a bitmap being present. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r--super1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/super1.c b/super1.c
index b15a1c7a..f6a10450 100644
--- a/super1.c
+++ b/super1.c
@@ -977,14 +977,14 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
info->array.chunk_size = __le32_to_cpu(sb->chunksize)*512;
info->array.state =
(__le64_to_cpu(sb->resync_offset) == MaxSector) ? 1 : 0;
- if (__le32_to_cpu(bsb->nodes) > 1)
- info->array.state |= (1 << MD_SB_CLUSTERED);
super_offset = __le64_to_cpu(sb->super_offset);
info->data_offset = __le64_to_cpu(sb->data_offset);
info->component_size = __le64_to_cpu(sb->size);
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_BITMAP_OFFSET)) {
info->bitmap_offset = (int32_t)__le32_to_cpu(sb->bitmap_offset);
+ if (__le32_to_cpu(bsb->nodes) > 1)
+ info->array.state |= (1 << MD_SB_CLUSTERED);
} else if (sb->feature_map & __le32_to_cpu(MD_FEATURE_PPL)) {
info->ppl_offset = __le16_to_cpu(sb->ppl.offset);
info->ppl_size = __le16_to_cpu(sb->ppl.size);