summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-02-02 11:06:38 +1100
committerNeilBrown <neilb@suse.de>2009-02-02 11:06:38 +1100
commitb47dff6675026053dc574f305df570d79754484e (patch)
tree24d3b459382344cace0755f413ebe772daddd76b /bitmap.c
parent0083584d5e8162f684112ed32da19888831d3190 (diff)
downloadmdadm-b47dff6675026053dc574f305df570d79754484e.tar.gz
mdadm-b47dff6675026053dc574f305df570d79754484e.tar.xz
mdadm-b47dff6675026053dc574f305df570d79754484e.zip
Fix possible crash if bitmap metadata is bad.
We really should never divide by 0. Thanks to "Jon Nelson" <jnelson-linux-raid@jamponi.net> for finding the problem. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bitmap.c b/bitmap.c
index b647939..352be5d 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -162,7 +162,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
sb_le_to_cpu(&info->sb); /* convert superblock to CPU byte ordering */
- if (brief || info->sb.sync_size == 0)
+ if (brief || info->sb.sync_size == 0 || info->sb.chunksize == 0)
goto out;
/* read the rest of the file counting total bits and dirty bits --